Files
SimUL/Assets/Scripts/InteractableObjects/Fridge.cs
T

52 lines
1.5 KiB
C#

using System.Collections.Generic;
using UnityEngine;
public class Fridge : BaseInteractableObject
{
[SerializeField]
private ContainerSO _containerSO;
[SerializeField]
private ItemActionsUI _actionsMenu;
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);
}
player.ClearContainerItem();
Debug.Log($"Fridge have {_foodObjects.Count} pices of food");
}
else
Debug.Log($"Fridge is full");
}
}
//else
//{
// //Eat menu
// if (_foodObjects.Count > 0)
// {
// while (player.Stats[StatsId.Food].Value < player.Stats[StatsId.Food].MaxValue && _foodObjects.Count > 0)
// {
// _foodObjects.RemoveAt(0);
// player.Eat();
// }
// }
//}
//_containerSO.CurrentItemsCount = _foodObjects.Count;
}
}