Maze / Library /PackageCache /com.unity.visualscripting@1.8.0 /Runtime /VisualScripting.Flow /Framework /Math /Divide.cs
| namespace Unity.VisualScripting | |
| { | |
| [] | |
| public abstract class Divide<T> : Unit | |
| { | |
| /// <summary> | |
| /// The dividend (or numerator). | |
| /// </summary> | |
| [] | |
| [] | |
| public ValueInput dividend { get; private set; } | |
| /// <summary> | |
| /// The divisor (or denominator). | |
| /// </summary> | |
| [] | |
| [] | |
| public ValueInput divisor { get; private set; } | |
| /// <summary> | |
| /// The quotient of the dividend and divisor (numerator / denominator). | |
| /// </summary> | |
| [] | |
| [] | |
| public ValueOutput quotient { get; private set; } | |
| [] | |
| protected virtual T defaultDivisor => default(T); | |
| [] | |
| protected virtual T defaultDividend => default(T); | |
| protected override void Definition() | |
| { | |
| dividend = ValueInput(nameof(dividend), defaultDividend); | |
| divisor = ValueInput(nameof(divisor), defaultDivisor); | |
| quotient = ValueOutput(nameof(quotient), Operation).Predictable(); | |
| Requirement(dividend, quotient); | |
| Requirement(divisor, quotient); | |
| } | |
| public abstract T Operation(T divident, T divisor); | |
| public T Operation(Flow flow) | |
| { | |
| return Operation(flow.GetValue<T>(dividend), flow.GetValue<T>(divisor)); | |
| } | |
| } | |
| } | |