Player put items in basket with UI indication
This commit is contained in:
@@ -7,11 +7,11 @@ public class ContainerItem : MonoBehaviour
|
||||
private ContainerSO _containerSO;
|
||||
|
||||
|
||||
private List<SellableItem> _items;
|
||||
private List<SellableItemSO> _items;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_items = new List<SellableItem>();
|
||||
_items = new List<SellableItemSO>();
|
||||
}
|
||||
|
||||
public ContainerSO GetContainerObjectSO()
|
||||
@@ -19,17 +19,21 @@ public class ContainerItem : MonoBehaviour
|
||||
return _containerSO;
|
||||
}
|
||||
|
||||
public void AddItem(SellableItem item)
|
||||
public void AddItem(SellableItemSO item)
|
||||
{
|
||||
if (_containerSO.CurrentItemsCount < _containerSO.MaxCapacity)
|
||||
if (_items.Count < _containerSO.MaxCapacity)
|
||||
{
|
||||
Debug.Log($"Player put to container a {item.GetSellableItemSO().objectName}");
|
||||
Debug.Log($"Player put to container a {item.ItemName}");
|
||||
_items.Add(item);
|
||||
_containerSO.CurrentItemsCount = _items.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Container is full");
|
||||
}
|
||||
}
|
||||
|
||||
public List<SellableItemSO> GetItems()
|
||||
{
|
||||
return _items;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user