Player can hold shopping basket
This commit is contained in:
@@ -9,36 +9,36 @@ public class Fridge : BaseInteractableObject
|
||||
[SerializeField]
|
||||
private ItemActionsUI _actionsMenu;
|
||||
|
||||
private List<FoodObject> _foodObjects = new List<FoodObject>();
|
||||
private List<FoodItem> _foodObjects = new List<FoodItem>();
|
||||
|
||||
public override void Interact(Player player)
|
||||
{
|
||||
|
||||
_actionsMenu.Show(_containerSO.Name, $"Max items:{_containerSO.MaxCapacity} current items: {_containerSO.CurrentItemsCount}");
|
||||
if (player.HasFoodObject())
|
||||
{
|
||||
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");
|
||||
}
|
||||
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;
|
||||
//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");
|
||||
//}
|
||||
//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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user