using Animancer; using System; using UnityEngine; public class PlayerVisual : MonoBehaviour { [SerializeField] NamedAnimancerComponent animancer; [SerializeField] private INFO _playerInfo; private void PlayActionEventHandler(PlayActionEvent @event) { BrewMonster.BMLogger.Log("PlayActionEventHandler : "+@event.AnimationName); animancer.TryPlay(@event.AnimationName); } public void InitHostPlayerEventDoneHandler() { animancer = GetComponentInChildren(); if(animancer == null) { BrewMonster.BMLogger.LogError("animancer == null"); return; } var player = GetComponentInParent(); if(player == null) { BrewMonster.BMLogger.LogError("player == null"); return; } _playerInfo = player.GetPlayInfo(); EventBus.SubscribeChannel(_playerInfo.cid, PlayActionEventHandler); } private void OnDestroy() { EventBus.UnsubscribeAllInChannel(_playerInfo.cid); } }