animation host done
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user