using UnityEditor.Graphs; using UnityEngine; /// /// This class holds data for an Item. Currently it has a name, an iconName and a base price. /// public abstract class Item { public readonly string name; public readonly string iconName; public readonly string description; public readonly ItemRarity rarity; public int basePrice { get; private set; } // This is the base price for the item, the buying and selling prices can be // generated based on this value. //------------------------------------------------------------------------------------------------------------------------ // Item() //------------------------------------------------------------------------------------------------------------------------ public Item(string name, string iconName, int pbasePrice, string itemDescr = "", ItemRarity rarity = ItemRarity.Common) { this.name = name; this.iconName = iconName; this.basePrice = pbasePrice; description = itemDescr; this.rarity = rarity; } // This is supposed to return what type an item identifies as, purely used for filtering public abstract ItemType GetItemType(); // Returns a nicely formatted text about the item's stats. Implementation-specific, because different types of items generate these differently public abstract string GetStats(); } /// /// Item type, mostly used as an identifier for item filters /// public enum ItemType { Weapon, Armor, Potion, All = 100 } [System.Serializable] public enum ItemRarity : int // Int representing color, so that this enum not only works as an identifier, but also contains name and col in just 32 bits. C#-Magic! { Common = 0xFFFFFF, Uncommon = 0x0000FF, Rare = 0x00FF00, Legendary = 0xFF00FF, Unique = 0xFFFF00 }