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; EquipmentSlots[i].Amount = 1; EquipmentSlots[i].Enchant = item.GetEnchant(); return(true); } } previousItem = null; return(false); }