40 lines
760 B
C#
40 lines
760 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ContainerItem : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private ContainerSO _containerSO;
|
|
|
|
|
|
private List<SellableItemSO> _items;
|
|
|
|
private void Start()
|
|
{
|
|
_items = new List<SellableItemSO>();
|
|
}
|
|
|
|
public ContainerSO GetContainerObjectSO()
|
|
{
|
|
return _containerSO;
|
|
}
|
|
|
|
public void AddItem(SellableItemSO item)
|
|
{
|
|
if (_items.Count < _containerSO.MaxCapacity)
|
|
{
|
|
Debug.Log($"Player put to container a {item.ItemName}");
|
|
_items.Add(item);
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("Container is full");
|
|
}
|
|
}
|
|
|
|
public List<SellableItemSO> GetItems()
|
|
{
|
|
return _items;
|
|
}
|
|
}
|