示例#1
0
        /// <inheritdoc />
        public override void TraverseToNextNode()
        {
            TraversableGraph traversableGraph = (TraversableGraph)graph;

            for (int i = 0; i < Conditions.Count; i++)
            {
                ConditionalEventSet condition = Conditions[i];

                if (condition.Evaluate())
                {
                    TraversableNode evaluatedCondition = GetConnectedNode($"{nameof(Conditions)} {i}");

                    if (evaluatedCondition != null)
                    {
                        evaluatedCondition.TriggerNode();
                    }
                    else
                    {
                        traversableGraph.SignalEndReached();
                    }

                    return;
                }
            }

            TraversableNode defaultNode = GetConnectedNode("Default");

            if (defaultNode != null)
            {
                defaultNode.TriggerNode();
            }
            else
            {
                traversableGraph.SignalEndReached();
            }
        }
示例#2
0
        /// <inheritdoc />
        public override void TraverseToNextNode()
        {
            TraversableGraph traversableGraph = (TraversableGraph)graph;

            TraversableNode exit = GetConnectedNode("Exit");

            if (exit != null)
            {
                exit.TriggerNode();
            }
            else
            {
                traversableGraph.SignalEndReached();
            }
        }