private void WritePushJumpStack(NodeInputExecPin pin) { if (!pinsJumpedTo.Contains(pin)) { pinsJumpedTo.Add(pin); } builder.AppendLine($"{JumpStackVarName}.Push({GetExecPinStateId(pin)});"); }
private void WriteGotoOutputPinIfNecessary(NodeOutputExecPin pin, NodeInputExecPin fromPin) { int fromId = GetExecPinStateId(fromPin); int nextId = fromId + 1; if (pin.OutgoingPin == null) { if (nextId != jumpStackStateId) { WriteGotoJumpStack(); } } else { int toId = GetExecPinStateId(pin.OutgoingPin); // Only write the goto if the next state is not // the state we want to go to. if (nextId != toId) { WriteGotoInputPin(pin.OutgoingPin); } } }
private int GetExecPinStateId(NodeInputExecPin pin) { return(nodeStateIds[pin.Node][pin.Node.InputExecPins.IndexOf(pin)]); }
private void WriteGotoInputPin(NodeInputExecPin pin) { builder.AppendLine($"goto State{GetExecPinStateId(pin)};"); }