using Animancer; using System; using UnityEngine; public class PlayerVisual : MonoBehaviour { [SerializeField] NamedAnimancerComponent animancer; private void Awake() { EventBus.Subscribe(InitHostPlayerEventDoneHandler); EventBus.Subscribe(PlayActionEventHandler); } private void PlayActionEventHandler(PlayActionEvent @event) { BrewMonster.Logger.Log("PlayActionEventHandler : "+@event.AnimationName); animancer.TryPlay(@event.AnimationName); } private void InitHostPlayerEventDoneHandler(InitHostPlayerEventDone done) { animancer = GetComponentInChildren(); if(animancer == null) { BrewMonster.Logger.Log("animancer == null"); } } private void OnDestroy() { EventBus.Unsubscribe(InitHostPlayerEventDoneHandler); EventBus.Unsubscribe(PlayActionEventHandler); } }