public override void Execute(GameObject context) { //Get the value to match string v = ((ProcessorNode)GetInputPort("value").GetConnection(0).node).GetValue(context).ToString(); //Find the index of the match int index = -1; for (int i = 0; i < cases.Length; i++) { if (cases[i].Equals(v)) { index = i; break; } } //Execute the branch corresponding to the match if (index == -1) { ExecuteNext(GetOutputPort("defaultNext"), context); } else { NodePort connection = GetOutputPort("cases").GetConnection(index); ExecutableNode next = (ExecutableNode)connection.node; next.Execute(context); } }
public void ExecuteNext(NodePort nextPort, GameObject context) { for (int i = 0; i < nextPort.ConnectionCount; i++) { NodePort connection = nextPort.GetConnection(i); ExecutableNode next = (ExecutableNode)connection.node; next.Execute(context); } }
public new void ExecuteNext(NodePort nextPort, GameObject context) { ((InteractionGraph)graph).activeNodes.Remove(this); for (int i = 0; i < nextPort.ConnectionCount; i++) { NodePort connection = nextPort.GetConnection(i); ExecutableNode next = (ExecutableNode)connection.node; ((InteractionGraph)graph).activeNodes.Add(next); next.Execute(context); } }