22 lines
495 B
C#
22 lines
495 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
public sealed class CooldownBehavior : NodeBehavior
|
|
{
|
|
private float nextAllowedAt;
|
|
|
|
public override void OnRun(string inputPortName)
|
|
{
|
|
if (base.IsAuthoritative && string.Equals(inputPortName, "In", StringComparison.Ordinal))
|
|
{
|
|
float num = Mathf.Max(0f, (float)GetInputNumber("Seconds"));
|
|
if (!(Time.unscaledTime < nextAllowedAt))
|
|
{
|
|
nextAllowedAt = Time.unscaledTime + num;
|
|
TriggerOutput("Out");
|
|
}
|
|
}
|
|
}
|
|
}
|