create base item SO for container. still need to set container type for different item types (sellable or not)

This commit is contained in:
Vladimir Koshevarov
2023-03-05 19:06:31 +02:00
parent 1b5e1b9359
commit 471fc5df93
9 changed files with 90 additions and 42 deletions
+19 -13
View File
@@ -9,23 +9,29 @@ public class Fridge : BaseInteractableObject
[SerializeField]
private ItemActionsUI _actionsMenu;
private List<FoodItem> _foodObjects = new List<FoodItem>();
private List<FoodItemSO> _foodObjects = new List<FoodItemSO>();
public override void Interact(Player player)
{
if (player.IsHoldContainerItem())
{
var playerContainer = player.GetContainerItem();
if (!playerContainer.IsSalebleItems())
{
if (_foodObjects.Count + playerContainer.GetItems().Count <= _containerSO.MaxCapacity)
{
foreach (FoodItemSO item in playerContainer.GetItems())
{
_foodObjects.Add(item);
}
//_actionsMenu.Show(_containerSO.Name, $"Max items:{_containerSO.MaxCapacity} current items: {_containerSO.CurrentItemsCount}");
//if (player.IsHoldContainer())
//{
// if (_foodObjects.Count < _containerSO.MaxCapacity)
// {
// _foodObjects.Add(player.GetFoodObject());
// player.ClearFoodObject();
// Debug.Log($"Fridge have {_foodObjects.Count} pices of food");
// }
// else
// Debug.Log($"Fridge is full");
//}
player.ClearContainerItem();
Debug.Log($"Fridge have {_foodObjects.Count} pices of food");
}
else
Debug.Log($"Fridge is full");
}
}
//else
//{
// //Eat menu