36 lines
774 B
C#
36 lines
774 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
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");
|
|
}
|
|
}
|
|
}
|