done else player animation
This commit is contained in:
@@ -5,11 +5,9 @@ using UnityEngine;
|
||||
public class PlayerVisual : MonoBehaviour
|
||||
{
|
||||
[SerializeField] NamedAnimancerComponent animancer;
|
||||
private void Awake()
|
||||
{
|
||||
EventBus.Subscribe<InitHostPlayerEventDone>(InitHostPlayerEventDoneHandler);
|
||||
EventBus.Subscribe<PlayActionEvent>(PlayActionEventHandler);
|
||||
}
|
||||
|
||||
[SerializeField] private INFO _playerInfo;
|
||||
|
||||
|
||||
private void PlayActionEventHandler(PlayActionEvent @event)
|
||||
{
|
||||
@@ -17,17 +15,25 @@ public class PlayerVisual : MonoBehaviour
|
||||
animancer.TryPlay(@event.AnimationName);
|
||||
}
|
||||
|
||||
private void InitHostPlayerEventDoneHandler(InitHostPlayerEventDone done)
|
||||
public void InitHostPlayerEventDoneHandler()
|
||||
{
|
||||
animancer = GetComponentInChildren<NamedAnimancerComponent>();
|
||||
if(animancer == null)
|
||||
{
|
||||
BrewMonster.Logger.Log("animancer == null");
|
||||
BrewMonster.Logger.LogError("animancer == null");
|
||||
return;
|
||||
}
|
||||
var player = GetComponentInParent<EC_Player>();
|
||||
if(player == null)
|
||||
{
|
||||
BrewMonster.Logger.LogError("player == null");
|
||||
return;
|
||||
}
|
||||
_playerInfo = player.GetPlayInfo();
|
||||
EventBus.SubscribeChannel<PlayActionEvent>(_playerInfo.cid, PlayActionEventHandler);
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
EventBus.Unsubscribe<InitHostPlayerEventDone>(InitHostPlayerEventDoneHandler);
|
||||
EventBus.Unsubscribe<PlayActionEvent>(PlayActionEventHandler);
|
||||
EventBus.UnsubscribeAllInChannel(_playerInfo.cid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user