put cola in basket
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ContainerItem : MonoBehaviour
|
||||
@@ -5,8 +6,30 @@ public class ContainerItem : MonoBehaviour
|
||||
[SerializeField]
|
||||
private ContainerSO _containerSO;
|
||||
|
||||
|
||||
private List<SellableItem> _items;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_items = new List<SellableItem>();
|
||||
}
|
||||
|
||||
public ContainerSO GetContainerObjectSO()
|
||||
{
|
||||
return _containerSO;
|
||||
}
|
||||
|
||||
public void AddItem(SellableItem item)
|
||||
{
|
||||
if (_containerSO.CurrentItemsCount < _containerSO.MaxCapacity)
|
||||
{
|
||||
Debug.Log($"Player put to container a {item.GetSellableItemSO().objectName}");
|
||||
_items.Add(item);
|
||||
_containerSO.CurrentItemsCount = _items.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Container is full");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ using UnityEngine;
|
||||
public class SellableItem : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private SellableItemSO _foodObjectSO;
|
||||
private SellableItemSO _sellableItemSO;
|
||||
|
||||
public SellableItemSO GetFoodObjectSO()
|
||||
public SellableItemSO GetSellableItemSO()
|
||||
{
|
||||
return _foodObjectSO;
|
||||
return _sellableItemSO;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user