KitchenChaos/Assets/Scripts/ContainerCounterVisual.cs

25 lines
615 B
C#

using System;
using UnityEngine;
public class ContainerCounterVisual : MonoBehaviour
{
[SerializeField] private ContainerCounter containerCounter;
private Animator animator;
private static readonly int openClose = Animator.StringToHash("OpenClose");
private void Awake()
{
animator = GetComponent<Animator>();
}
private void Start()
{
containerCounter.OnPlayerGrabbedObject += ContainerCounbter_OnPlayerGrabbedObject;
}
private void ContainerCounbter_OnPlayerGrabbedObject(object sender, EventArgs e)
{
animator.SetTrigger(openClose);
}
}