25 lines
467 B
C#
25 lines
467 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
public sealed class OnceBehavior : NodeBehavior
|
|
{
|
|
private bool fired;
|
|
|
|
public override void OnRun(string inputPortName)
|
|
{
|
|
if (base.IsAuthoritative)
|
|
{
|
|
if (string.Equals(inputPortName, "Reset", StringComparison.Ordinal))
|
|
{
|
|
fired = false;
|
|
}
|
|
else if (string.Equals(inputPortName, "In", StringComparison.Ordinal) && !fired)
|
|
{
|
|
fired = true;
|
|
TriggerOutput("Out");
|
|
}
|
|
}
|
|
}
|
|
}
|