simple eating )

This commit is contained in:
2023-02-28 23:41:38 +02:00
parent 75b9665674
commit 811b2efc85
9 changed files with 55 additions and 252 deletions
@@ -10,6 +10,7 @@ public class ColaFreezer : BaseInteractableObject
{
if (!player.HasFoodObject())
{
player.BuyObject(_foodObjectSO);
// Spawn new object and set to player
var transform = Instantiate(_foodObjectSO.prefab, _playerArrivePoint);
var foodObject = transform.GetComponent<FoodObject>();
+13 -1
View File
@@ -4,7 +4,7 @@ using UnityEngine;
public class Fridge : BaseInteractableObject
{
private const int _maxCapacity=4;
private const int _maxCapacity=10;
private List<FoodObject> _foodObjects= new List<FoodObject>();
public override void Interact(Player player)
@@ -20,6 +20,18 @@ public class Fridge : BaseInteractableObject
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();
}
}
}
}