Beispiel #1
0
    public void RepairArmor(string equipmentType)
    {
        // Repair Kit available?
        Item repairKit = inventory.GetItem("Item Repair Kit");

        if (!repairKit)
        {
            Debug.Log($"An Item Repair Kit is needed to repair armor");
            return;
        }

        // Get armor
        EquipmentType  type  = ( EquipmentType )System.Enum.Parse(typeof(EquipmentType), equipmentType);
        EquippableItem armor = equipmentPanel.GetEquipmentType(type);

        // Armor equipped?
        if (!armor)
        {
            Debug.Log($"No {type} is currently equipped. Cannot repair armor");
            return;
        }

        // Repair?
        if (!armor.CanRepair)
        {
            return;
        }

        armor.Repair();
        inventory.RemoveItem(repairKit.ID).Destroy();
    }