using EasyTalk.Nodes.Core; using System; namespace EasyTalk.Nodes.Flow { /// /// A node which allows and ordered sequence of dialogue flow paths to be followed in order each time the node is processed. /// [Serializable] public class SequenceNode : ListNode, DialogueFlowNode { /// /// The index of the current dialogue flow path to follow. /// private int currentIdx = 0; /// /// Creates a new SequenceNode. /// public SequenceNode() { this.name = "SEQ"; this.nodeType = NodeType.SEQUENCE; } /// public NodeConnection GetFlowInput() { return Inputs[0]; } /// public NodeConnection GetFlowOutput() { if(Outputs.Count > 0) { int outputIdx = currentIdx; if (currentIdx < Outputs.Count - 1) { currentIdx++; } else { currentIdx = 0; } return Outputs[outputIdx]; } return null; } } /// /// A dialogue flow path item for a sequence node. /// [Serializable] public class SequenceItem : ListItem { } }