Class OperatorNode<T1, T2, TOut>
Abstract base node for performing mathematical/logic operations on two input values.
public abstract class OperatorNode<T1, T2, TOut> : BaseNode
Type Parameters
| Name | Type | Description |
|---|---|---|
T1 | The type of the first input value. | |
T2 | The type of the second input value. | |
TOut | The type of the output value. |
Inheritance
Examples
Subclass OperatorNode and override XNode.Node.GetValue to implement
a concrete arithmetic or logic operation. The type parameters drive the automatically-generated port types;
Value_A and Value_B already handle type conversion and port-connection fallback, so the
override body stays minimal. The pattern below mirrors the existing AddNode implementation.
using XNode;
using mobisim.Scenes.SNGraph;
[CreateNodeMenu("Operator/Max")]
public class MaxNode : OperatorNode
{
// Return the larger of the two connected (or inline) values.
public override object GetValue(NodePort port)
=> Mathf.Max(Value_A, Value_B);
private void Reset() => name = "Max";
}