Ejemplo n.º 1
0
 public void Unequip(EquippableItem item)
 {
     if (!inventory.IsFull() && equipmentPanel.RemoveItem(item))
     {
         item.Unequip(this);
         statPanel.UpdateStatValues();
         inventory.AddItem(item);
     }
 }
 public bool RemoveItem(EquippableItem item)
 {
     for (int i = 0; i < equipmentSlots.Length; i++)
     {
         if (equipmentSlots[i].Item == item)
         {
             equipmentSlots[i].Item = null;
             return(true);
         }
     }
     return(false);
 }
 public bool AddItem(EquippableItem item, out EquippableItem previousItem)
 {
     for (int i = 0; i < equipmentSlots.Length; i++)
     {
         if (equipmentSlots[i].EquipmentType == item.EquipmentType)
         {
             previousItem           = (EquippableItem)equipmentSlots[i].Item;
             equipmentSlots[i].Item = item;
             return(true);
         }
     }
     previousItem = null;
     return(false);
 }
Ejemplo n.º 4
0
 public bool RemoveItem(EquippableItem item)
 {
     for (int i = 0; i < equipmentSlots.Length; i++)
     {
         if (equipmentSlots[i].Item == item)
         {
             equipmentSlots[i].Item = null;
             RemoveFromEquipmentList(item);
             hero.OnEquipmentChange(equipment);
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        public void ShowTooltip(Item itemToShow)
        {
            if (!(itemToShow is EquippableItem))
            {
                return;
            }

            EquippableItem item = (EquippableItem)itemToShow;

            gameObject.SetActive(true);

            nameText.text     = item.ItemName;
            slotTypeText.text = item.EquipmentType.ToString();

            sb.Length = 0;

            AddStatText(item.strengthBonus, " Strength");
            AddStatText(item.dexterityBonus, " Dexterity");
            AddStatText(item.intellectBonus, " Intellect");
            AddStatText(item.attackBonus, " Attack");
            AddStatText(item.defenseBonus, " Defense");
            AddStatText(item.critChanceBonus, " Crit Chance");
            AddStatText(item.critPowerBonus, " Crit Power");
            AddStatText(item.abilityCritChanceBonus, " Ability Crit Chance");
            AddStatText(item.abilityCritPowerBonus, " Ability Crit Power");
            AddStatText(item.dodgeBonus * 100, " Dodge Chance");
            AddStatText(item.movementBonus, " Movement");

            AddStatText(item.strengthPercentBonus * 100, "% Strength");
            AddStatText(item.dexterityPercentBonus * 100, "% Dexterity");
            AddStatText(item.intellectPercentBonus * 100, "% Intellect");
            AddStatText(item.attackPercentBonus * 100, "% Attack");
            AddStatText(item.defensePercentBonus * 100, "% Defense");
            AddStatText(item.critChancePercentBonus * 100, "% Crit Chance");
            AddStatText(item.critPowerPercentBonus * 100, "% Crit Power");
            AddStatText(item.abilityCritChancePercentBonus * 100, "% Ability Crit Chance");
            AddStatText(item.abilityCritPowerPercentBonus * 100, "% Ability Crit Power");
            AddStatText(item.dodgePercentBonus * 100, "% Dodge Chance");
            AddStatText(item.movementPercentBonus * 100, "% Movement");

            statsText.text = sb.ToString();
        }
Ejemplo n.º 6
0
 public bool AddItem(EquippableItem item, out EquippableItem previousItem)
 {
     for (int i = 0; i < equipmentSlots.Length; i++)
     {
         if (equipmentSlots[i].EquipmentType == item.EquipmentType)
         {
             previousItem           = (EquippableItem)equipmentSlots[i].Item;
             equipmentSlots[i].Item = item;
             if (previousItem)
             {
                 RemoveFromEquipmentList(previousItem);
             }
             AddToEquipmentList(item);
             hero.OnEquipmentChange(equipment);
             return(true);
         }
     }
     previousItem = null;
     return(false);
 }
Ejemplo n.º 7
0
 public void Equip(EquippableItem item)
 {
     if (inventory.RemoveItem(item))
     {
         EquippableItem previousItem;
         if (equipmentPanel.AddItem(item, out previousItem))
         {
             if (previousItem != null)
             {
                 inventory.AddItem(previousItem);
                 previousItem.Unequip(this);
                 statPanel.UpdateStatValues();
             }
             item.Equip(this);
             statPanel.UpdateStatValues();
         }
         else
         {
             inventory.AddItem(item);
         }
     }
 }