Example #1
0
 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);
 }
Example #2
0
 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;
         }
     }
 }
Example #3
0
 public Garden()
 {
     Size           = 3;
     Slots          = new Items.GameItems[Size];
     AvailableSeeds = new List <Items.GameItems>();
 }