Add simple fridge logic

This commit is contained in:
2023-02-28 22:48:28 +02:00
parent ee07359c50
commit 04d79318d1
25 changed files with 844 additions and 92 deletions
+17 -1
View File
@@ -1,10 +1,26 @@
using System.Collections.Generic;
using UnityEngine;
public class Fridge : BaseInteractableObject
{
private const int _maxCapacity=4;
private List<FoodObject> _foodObjects= new List<FoodObject>();
public override void Interact(Player player)
{
Debug.Log("Interact with Fridge");
if (player.HasFoodObject())
{
if (_foodObjects.Count < _maxCapacity)
{
_foodObjects.Add(player.GetFoodObject());
player.ClearFoodObject();
Debug.Log($"Fridge have {_foodObjects.Count} pices of food");
}
else
Debug.Log($"Fridge is full");
}
}
}