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