Example #1
0
 private void RepairItem(Item item)
 {
     if (item != null)
     {
         if (item is EquipmentItem)
         {
             double increaseValue = this.gameObject.GetComponentInParent <RepairInventory>().RepairValue;
             int    increaseCost  = this.gameObject.GetComponentInParent <RepairInventory>().RepairTickCost;
             if (this.IfICanSellBuyItem(this.inventory_gold, increaseCost))
             {
                 EquipmentItem equipmentItem = (EquipmentItem)item;
                 if (equipmentItem.Durability < 100)
                 {
                     equipmentItem.Repair(increaseValue);
                     this.IncreaseDecreaseGold(-increaseCost);
                 }
                 else
                 {
                     this.PrintToInfoPanel("Item has max durability");
                 }
             }
             else
             {
                 this.PrintToInfoPanel("You dont have enough gold");
             }
         }
     }
 }