27 lines
652 B
C#
27 lines
652 B
C#
|
|
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)
|
|
{
|
|
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");
|
|
}
|
|
}
|
|
|
|
|
|
}
|