Files
2026-06-01 17:19:55 +02:00

34 lines
597 B
C#

using UnityEngine;
[DisallowMultipleComponent]
public sealed class OnPlayerJoinedBehavior : NodeBehavior
{
private NodeGraphManager graph;
private void OnEnable()
{
graph = NodeGraphManager.Instance;
if (graph != null)
{
graph.PlayerJoined += HandlePlayerJoined;
}
}
private void OnDisable()
{
if (graph != null)
{
graph.PlayerJoined -= HandlePlayerJoined;
}
}
private void HandlePlayerJoined(int actorNumber)
{
if (!(Node == null) && actorNumber > 0)
{
SetLocalOutputValue("Player", BSValue.FromPlayer(actorNumber));
Node.TriggerRun("Joined");
}
}
}