public void UnequipArmor() { if (EquippedArmor != null) Items.Add(EquippedArmor); EquippedArmor = null; }
public void UseItem(int index) { if (Items.Count > index) { if (Items[index] is Armor) { UnequipArmor(); EquippedArmor = (Armor)Items[index]; Items.RemoveAt(index); return; } if (Items[index] is Weapon) { UnequipWeapon(); EquippedWeapon = (Weapon)Items[index]; Items.RemoveAt(index); return; } if (Items[index] is Offhand) { UnequipOffhand(); EquippedOffhand = (Offhand)Items[index]; Items.RemoveAt(index); return; } Items[index].Use(attachedCharacter); } Items.RemoveAll(o => o == null); Items.RemoveAll(o => o.Destroy); }