Added basic popup action menu
This commit is contained in:
@@ -4,14 +4,20 @@ using UnityEngine;
|
||||
|
||||
public class Fridge : BaseInteractableObject
|
||||
{
|
||||
private const int _maxCapacity=10;
|
||||
private List<FoodObject> _foodObjects= new List<FoodObject>();
|
||||
[SerializeField]
|
||||
private ContainerSO _containerSO;
|
||||
[SerializeField]
|
||||
private ItemActionsUI _actionsMenu;
|
||||
|
||||
private List<FoodObject> _foodObjects = new List<FoodObject>();
|
||||
|
||||
public override void Interact(Player player)
|
||||
{
|
||||
|
||||
_actionsMenu.Show(_containerSO.Name, $"Max items:{_containerSO.MaxCapacity} current items: {_containerSO.CurrentItemsCount}");
|
||||
if (player.HasFoodObject())
|
||||
{
|
||||
if (_foodObjects.Count < _maxCapacity)
|
||||
if (_foodObjects.Count < _containerSO.MaxCapacity)
|
||||
{
|
||||
_foodObjects.Add(player.GetFoodObject());
|
||||
player.ClearFoodObject();
|
||||
@@ -20,19 +26,20 @@ public class Fridge : BaseInteractableObject
|
||||
else
|
||||
Debug.Log($"Fridge is full");
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
//Eat menu
|
||||
if (_foodObjects.Count>0)
|
||||
if (_foodObjects.Count > 0)
|
||||
{
|
||||
while(player.Stats[StatsId.Food].Value< player.Stats[StatsId.Food].MaxValue && _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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user