Rasagar/Library/PackageCache/com.unity.visualscripting/Runtime/VisualScripting.Flow/Framework/Math/PerSecond.cs

36 lines
906 B
C#
Raw Normal View History

2024-08-26 13:07:20 -07:00
namespace Unity.VisualScripting
{
[UnitOrder(601)]
public abstract class PerSecond<T> : Unit
{
/// <summary>
/// The input value.
/// </summary>
[DoNotSerialize]
[PortLabelHidden]
public ValueInput input { get; private set; }
/// <summary>
/// The framerate-normalized value (multiplied by delta time).
/// </summary>
[DoNotSerialize]
[PortLabelHidden]
public ValueOutput output { get; private set; }
protected override void Definition()
{
input = ValueInput(nameof(input), default(T));
output = ValueOutput(nameof(output), Operation);
Requirement(input, output);
}
public abstract T Operation(T input);
public T Operation(Flow flow)
{
return Operation(flow.GetValue<T>(input));
}
}
}