using System.Collections; using System.Collections.Generic; using UnityEngine; public class Inventory : MonoBehaviour { private List itemList; private int maxItems = 7; public Inventory() { itemList = new List(); AddItem(new Item { itemType = Item.ItemType.BluePotion, amount = 1 }); } public void AddItem(Item item) { if (itemList.Count < maxItems) { itemList.Add(item); Debug.Log(itemList); } else { Debug.Log("Ekwipunek jest pełny! Nie można dodać więcej przedmiotów."); } } public List GetItemList() { return itemList; } public void RemoveItem(Item item) { var FoundItem = itemList.Find(x => x == item); if (FoundItem.amount > 1) { FoundItem.RemoveAmount(1); } else { itemList.Remove(item); } } }