namespace Unity.VisualScripting { [UnitOrder(103)] public abstract class Multiply : Unit { /// /// The first value. /// [DoNotSerialize] public ValueInput a { get; private set; } /// /// The second value. /// [DoNotSerialize] public ValueInput b { get; private set; } /// /// The product of A and B. /// [DoNotSerialize] [PortLabel("A \u00D7 B")] public ValueOutput product { get; private set; } [DoNotSerialize] protected virtual T defaultB => default(T); protected override void Definition() { a = ValueInput(nameof(a)); b = ValueInput(nameof(b), defaultB); product = ValueOutput(nameof(product), Operation).Predictable(); Requirement(a, product); Requirement(b, product); } private T Operation(Flow flow) { return Operation(flow.GetValue(a), flow.GetValue(b)); } public abstract T Operation(T a, T b); } }