33 lines
516 B
C#
33 lines
516 B
C#
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
public sealed class OnPlayerLeftBehavior : NodeBehavior
|
|
{
|
|
private NodeGraphManager graph;
|
|
|
|
private void OnEnable()
|
|
{
|
|
graph = NodeGraphManager.Instance;
|
|
if (graph != null)
|
|
{
|
|
graph.PlayerLeft += HandlePlayerLeft;
|
|
}
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
if (graph != null)
|
|
{
|
|
graph.PlayerLeft -= HandlePlayerLeft;
|
|
}
|
|
}
|
|
|
|
private void HandlePlayerLeft(int actorNumber)
|
|
{
|
|
if (!(Node == null) && actorNumber > 0)
|
|
{
|
|
Node.TriggerRun("Left");
|
|
}
|
|
}
|
|
}
|