// call the constructor of base class(Item) and set the variables public Equipment(string itemName_, string description_, ItemTpye itemType_, Quality quality_, string spriteNeutral_, string spriteHighlighted_, int maxSize_, int intellect_, int agility_, int stamina_, int strength_) : base(itemName_, description_, itemType_, quality_, spriteNeutral_, spriteHighlighted_, maxSize_) { Intellect = intellect_; Agility = agility_; Stamina = stamina_; Strength = strength_; }
public Item(string itemName_, string description_, ItemTpye itemType_, Quality quality_, string spriteNeutral_, string spriteHighlighted_, int maxSize_) { // set the all the values from the parameter ItemName = itemName_; Description = description_; itemType = itemType_; quality = quality_; SpriteNeutral = spriteNeutral_; SpriteHighlighted = spriteHighlighted_; MaxSize = maxSize_; }
// call the constructor of base class(Item) and set the variables public Weapon(string itemName_, string description_, ItemTpye itemType_, Quality quality_, string spriteNeutral_, string spriteHighlighted_, int maxSize_, int intellect_, int agility_, int stamina_, int strength_, float attackSpeed_) : base(itemName_, description_, itemType_, quality_, spriteNeutral_, spriteHighlighted_, maxSize_, intellect_, agility_, stamina_, strength_) { AttackSpeed = attackSpeed_; }
public void LoadInventory() { int invNum = 0; foreach (Inventory inv in inventory) { // load the content string content = PlayerPrefs.GetString("content" + invNum); // load the inventory data inv.slots = PlayerPrefs.GetInt("slots" + invNum); inv.rows = PlayerPrefs.GetInt("rows" + invNum); inv.slotPaddingLeft = PlayerPrefs.GetFloat("slotPaddingLeft" + invNum); inv.slotPaddingTop = PlayerPrefs.GetFloat("slotPaddingTop" + invNum); inv.slotSize = PlayerPrefs.GetFloat("slotSize" + invNum); //inventoryRect.position = new Vector3(PlayerPrefs.GetFloat("xPos"), PlayerPrefs.GetFloat("yPos"), inventoryRect.position.z); // create the layout inv.CreateLayout(); // put the content back into the inventory //0-Mana-3 string[] splitContent = content.Split(";".ToCharArray()); // 0-Mana-3 // loop through the split content for (int x = 0; x < splitContent.Length - 1; x++) { // split the first value string[] splitValues = splitContent[x].Split("-".ToCharArray()); // get the slot int index = Int32.Parse(splitValues[0]); //"0" // get the itemScript type ItemTpye type = (ItemTpye)Enum.Parse(typeof(ItemTpye), splitValues[1]); // "mana" // get the amount of itemScript in the slot int amount = Int32.Parse(splitValues[2]); //"3" // place the itemScript in the slot for (int i = 0; i < amount; i++) { // add the itemScript into the slot of inventory switch (type) { //case ItemTpye.Mana: // inv.allSlots[index].GetComponent<Slot>().AddItem(InventoryManager.Instance.Mana.GetComponent<ItemScript>()); // break; //case ItemTpye.Health: // inv.allSlots[index].GetComponent<Slot>().AddItem(InventoryManager.Instance.Health.GetComponent<ItemScript>()); // break; //case ItemTpye.Sword: // inv.allSlots[index].GetComponent<Slot>().AddItem(InventoryManager.Instance.Sword.GetComponent<ItemScript>()); // break; } } } invNum++; } Debug.Log("Loading"); }
// call the constructor of base class(Item) and set the variables public Consumable(string itemName_, string description_, ItemTpye itemType_, Quality quality_, string spriteNeutral_, string spriteHighlighted_, int maxSize_, int health_, int mana_) : base(itemName_, description_, itemType_, quality_, spriteNeutral_, spriteHighlighted_, maxSize_) { Health = health_; Mana = mana_; }