public void AddItemToInventory(Items.GameItems item) { for (int i = 0; i < Inventory.Count; i++) { if (Inventory[i].ID.Equals(item.ID)) { Inventory[i].Quantity++; return; } } Inventory.Add(item); }
public void RemoveItemToInventory(Items.GameItems item, int quantity = 1) { for (int i = 0; i < Inventory.Count; i++) { if (Inventory[i].ID.Equals(item.ID)) { if (Inventory[i].Quantity > quantity) { if (Inventory[i].Quantity == quantity) { Inventory.Remove(Inventory[i]); } Inventory[i].Quantity -= quantity; } else { Inventory.Remove(Inventory[i]); } return; } } }
public Garden() { Size = 3; Slots = new Items.GameItems[Size]; AvailableSeeds = new List <Items.GameItems>(); }