Maze / Library /PackageCache /com.unity.visualscripting@1.8.0 /Runtime /VisualScripting.Flow /Framework /Math /Subtract.cs
| namespace Unity.VisualScripting | |
| { | |
| [] | |
| public abstract class Subtract<T> : Unit | |
| { | |
| /// <summary> | |
| /// The first value (minuend). | |
| /// </summary> | |
| [] | |
| [] | |
| public ValueInput minuend { get; private set; } | |
| /// <summary> | |
| /// The second value (subtrahend). | |
| /// </summary> | |
| [] | |
| [] | |
| public ValueInput subtrahend { get; private set; } | |
| /// <summary> | |
| /// The difference, that is the minuend minus the subtrahend. | |
| /// </summary> | |
| [] | |
| [] | |
| public ValueOutput difference { get; private set; } | |
| [] | |
| protected virtual T defaultMinuend => default(T); | |
| [] | |
| protected virtual T defaultSubtrahend => default(T); | |
| protected override void Definition() | |
| { | |
| minuend = ValueInput(nameof(minuend), defaultMinuend); | |
| subtrahend = ValueInput(nameof(subtrahend), defaultSubtrahend); | |
| difference = ValueOutput(nameof(difference), Operation).Predictable(); | |
| Requirement(minuend, difference); | |
| Requirement(subtrahend, difference); | |
| } | |
| public abstract T Operation(T a, T b); | |
| public T Operation(Flow flow) | |
| { | |
| return Operation(flow.GetValue<T>(minuend), flow.GetValue<T>(subtrahend)); | |
| } | |
| } | |
| } | |