KitchenChaos/Assets/Scripts/Counters/ContainerCounter.cs

24 lines
718 B
C#

using System;
using ScriptableObjects;
using UnityEngine;
namespace Counters {
public class ContainerCounter : BaseCounter {
[SerializeField] private KitchenObjectSO kitchenObjectSO;
public event EventHandler OnPlayerGrabbedObject;
public override void Interact(Player player) {
if (!HasKitchenObject()) {
// Debug.Log("ContainerCounter has no KitchenObject");
if (!player.HasKitchenObject()) {
// Debug.Log("Player is taking a KitchenObject from the ContainerCounter");
KitchenObject.SpawnKitchenObject(kitchenObjectSO, player);
OnPlayerGrabbedObject?.Invoke(this, EventArgs.Empty);
}
else {
// Debug.Log("Player has already something in the hand");
}
}
}
}
}