Ejemplo n.º 1
0
        public BehaviourTreeBuilder ConnectTree(BehaviourTreeBuilder treePart)
        {
            BehaviourTreeNode child = treePart.Build();

            if (this.root == null)
            {
                this.root = child;
                return(this);
            }
            this.AddChild(child);
            return(this);
        }
Ejemplo n.º 2
0
        public BehaviourTreeBuilder StartParallel()
        {
            ParallelNode node = new ParallelNode();

            if (this.root == null)
            {
                this.root = node;
                this.builderStack.Push(node);
                return(this);
            }
            this.AddChild(node);
            this.builderStack.Push(node);
            return(this);
        }
Ejemplo n.º 3
0
        private void AddChild(BehaviourTreeNode child)
        {
            object obj2 = this.builderStack.Peek();

            if (ReferenceEquals(obj2.GetType().BaseType, typeof(CompositeNode)))
            {
                (obj2 as CompositeNode).AddChild(child);
            }
            if (ReferenceEquals(obj2.GetType().BaseType, typeof(DecoratorNode)))
            {
                (obj2 as DecoratorNode).AddChild(child);
                this.builderStack.Pop();
            }
        }
Ejemplo n.º 4
0
        public BehaviourTreeBuilder StartSequence()
        {
            SequenceNode node = new SequenceNode();

            if (this.root == null)
            {
                this.root = node;
                this.builderStack.Push(node);
                return(this);
            }
            this.AddChild(node);
            this.builderStack.Push(node);
            return(this);
        }
Ejemplo n.º 5
0
        public BehaviourTreeBuilder StartPreconditionSequence()
        {
            PreconditionSequence sequence = new PreconditionSequence();

            if (this.root == null)
            {
                this.root = sequence;
                this.builderStack.Push(sequence);
                return(this);
            }
            this.AddChild(sequence);
            this.builderStack.Push(sequence);
            return(this);
        }
Ejemplo n.º 6
0
        public BehaviourTreeBuilder StartDoOnceIn(float time)
        {
            OnceInTimeNode node = new OnceInTimeNode {
                Time = time
            };

            if (this.root == null)
            {
                this.root = node;
                this.builderStack.Push(node);
                return(this);
            }
            this.AddChild(node);
            this.builderStack.Push(node);
            return(this);
        }
Ejemplo n.º 7
0
 public void AddChild(BehaviourTreeNode child)
 {
     this.Child = child;
 }
Ejemplo n.º 8
0
 public void AddChild(BehaviourTreeNode child)
 {
     this.children.Add(child);
 }