public void Unequip(InventoryItem item) { if (Helmet == item) { Helmet = null; } if (Armor == item) { Armor = null; } if (Weapon == item) { Weapon = null; } if (Offhand == item) { Offhand = null; } if (OnHeroEquipmentChanged != null) { Debug.Log(name + " equipment unequpped, listen up!"); OnHeroEquipmentChanged.Invoke(this); } else { Debug.Log(name + " equipment unequpped, nobody cared"); } }
public bool Equip(InventoryItem item) { if (item == null) { return(false); } if (item.Type != ItemType.Equipment) { return(false); } switch (item.Slot) { default: Debug.Log("Hero Doesn't know how to equip on slot " + item.Slot); return(false); case EquipSlot.Helmet: Party.I.PartyInventory.AddItem(Helmet); Helmet = item; break; case EquipSlot.Armor: Party.I.PartyInventory.AddItem(Armor); Armor = item; break; case EquipSlot.Weapon: Party.I.PartyInventory.AddItem(Weapon); Weapon = item; break; case EquipSlot.Offhand: Party.I.PartyInventory.AddItem(Offhand); Offhand = item; break; } if (OnHeroEquipmentChanged != null) { Debug.Log(name + " equipment change, listen up!"); OnHeroEquipmentChanged.Invoke(this); } else { Debug.Log(name + " equipment change, nobody cared"); } return(true); }