create base item SO for container. still need to set container type for different item types (sellable or not)
This commit is contained in:
@@ -9,23 +9,29 @@ public class Fridge : BaseInteractableObject
|
||||
[SerializeField]
|
||||
private ItemActionsUI _actionsMenu;
|
||||
|
||||
private List<FoodItem> _foodObjects = new List<FoodItem>();
|
||||
private List<FoodItemSO> _foodObjects = new List<FoodItemSO>();
|
||||
|
||||
public override void Interact(Player player)
|
||||
{
|
||||
if (player.IsHoldContainerItem())
|
||||
{
|
||||
var playerContainer = player.GetContainerItem();
|
||||
if (!playerContainer.IsSalebleItems())
|
||||
{
|
||||
if (_foodObjects.Count + playerContainer.GetItems().Count <= _containerSO.MaxCapacity)
|
||||
{
|
||||
foreach (FoodItemSO item in playerContainer.GetItems())
|
||||
{
|
||||
_foodObjects.Add(item);
|
||||
}
|
||||
|
||||
//_actionsMenu.Show(_containerSO.Name, $"Max items:{_containerSO.MaxCapacity} current items: {_containerSO.CurrentItemsCount}");
|
||||
//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");
|
||||
//}
|
||||
player.ClearContainerItem();
|
||||
Debug.Log($"Fridge have {_foodObjects.Count} pices of food");
|
||||
}
|
||||
else
|
||||
Debug.Log($"Fridge is full");
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// //Eat menu
|
||||
|
||||
Reference in New Issue
Block a user