예제 #1
0
        /// <summary>
        ///     Triggers this node within the graph.
        /// </summary>
        public virtual void TriggerNode()
        {
            TraversableGraph traversableGraph = (TraversableGraph)graph;

            if (traversableGraph != null)
            {
                traversableGraph.CurrentNode = this;
            }

            traversableGraph.SignalNodeTriggered();

#if UNITY_EDITOR
            EditorWindow.GetWindow <NodeEditorWindow>("xNode", false)?.Repaint();
#endif
        }
예제 #2
0
        /// <inheritdoc />
        public override void TraverseToNextNode()
        {
            TraversableGraph traversableGraph = (TraversableGraph)graph;

            TraversableNode exit = GetConnectedNode("Exit");

            if (exit != null)
            {
                exit.TriggerNode();
            }
            else
            {
                traversableGraph.SignalEndReached();
            }
        }
예제 #3
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();
            }
        }