コード例 #1
0
ファイル: SequentialNode.cs プロジェクト: Mahmood34/Withering
        private void HandleNextNode()
        {
            if (childQueue.Count == 0)
            {
                Done();
                return;
            }

            FluentNode firstNode = childQueue.Dequeue();

            firstNode.SetDoneCallback(SequentialChildCompleted);
            firstNode.Execute();
        }
コード例 #2
0
        private void HandleNextNode()
        {
            // Check if all the nodes have been handled
            if (childQueue.Count == 0)
            {
                // Start the options presenter
                optionsPresenter.SetupOptions(this);
                return;
            }


            FluentNode firstNode = childQueue.Dequeue();

            firstNode.SetDoneCallback(SequentialChildCompleted);
            firstNode.Execute();
        }
コード例 #3
0
ファイル: WhileNode.cs プロジェクト: Mahmood34/Withering
        private void HandleNextNode()
        {
            // Check if we handled all the children
            if (childQueue.Count == 0)
            {
                // Lets see if we should restart the while
                if (!test())
                {
                    Done();
                    return;
                }

                // Add all the children again
                Children.ForEach(n => childQueue.Enqueue(n));
            }

            FluentNode firstNode = childQueue.Dequeue();

            firstNode.SetDoneCallback(ChildCompleted);
            firstNode.Execute();
        }
コード例 #4
0
        private void HandleNextNode()
        {
            if (childrenLeftToExecute.Count == 0)
            {
                // Ugh, think about cleanup
                if (GoesBack && (Parent is OptionsNode) && (Parent.Parent is OptionNode) && (Parent.Parent.Parent is OptionsNode))
                {
                    Parent.Parent.Parent.Execute();
                }
                else
                {
                    HasBeenChosen = true;
                    Done();
                }

                return;
            }

            FluentNode firstNode = childrenLeftToExecute.Dequeue();

            firstNode.SetDoneCallback(OptionChildCompleted);
            firstNode.Execute();
        }
コード例 #5
0
        /// <summary>
        /// Call this to start the FluentScript
        /// </summary>
        public virtual void Run()
        {
            //
            OnStart();

            // Create the fluent script
            FluentNode firstNode = SequentialNode(Create());

            // Do a couple of things to the tree before execution starts
            firstNode.Visit((n) =>
            {
                // Tell all the children who the parent is
                n.Children.ForEach(c => c.Parent = n);

                // Run their before execute methods
                n.BeforeExecute();
            });

            //
            firstNode.SetDoneCallback(RootDone);

            //
            firstNode.Execute();
        }