public void Load(UserData data) { this.data = data; for (int i = 0; i < data.equipment.Count; i++) { EquipmentItem item = (EquipmentItem)ItemBase.GetItem(data.equipment[i]); Items.Add(item); item.Equip(Player); } }
public EquipmentItem EquipItem(EquipmentItem item) { EquipmentItem oldItem = null; for (var i = 0; i < Items.Count; i++) { if (((EquipmentItem)Items[i]).EquipSlot == item.EquipSlot) { oldItem = (EquipmentItem)Items[i]; oldItem.Unequip(Player); data.equipment.Remove(ItemBase.GetItemId(Items[i])); Items.RemoveAt(i); break; } } Items.Add(item); item.Equip(Player); data.equipment.Add(ItemBase.GetItemId(item)); return(oldItem); }