Example #1
0
        private void Awake()
        {
            /* The deepest-level node is Node 3, which has no children. */
            var node3 = new ActionNode(NotEqualToTarget);
            /** Next up, we create the level 2 nodes. */
            var node2A = new ActionNode(AddTen);
            /** Node 2B is a selector which has node 3 as a child, so we'll pass node 3 to the constructor */
            //var node2B = new InverterNode(node3);
            var node2B = new RepeaterNode(node3, Node.NodeState.Failure, 500);

            var node2C = new ActionNode(AddTen);
            /** Lastly, we have our root node. First, we prepare our list of children nodes to pass in */
            List <Node> rootChildren = new List <Node> {
                node2A, node2B, node2C
            };
            /** Then we create our root node object and pass in the list */
            var rootNode = new SelectorNode(rootChildren);

            this._nodes[0].node = rootNode;
            this._nodes[1].node = node2A;
            this._nodes[2].node = node2B;
            this._nodes[3].node = node3;
            this._nodes[4].node = node2C;
            this._evaluateJob.OnEvaluateDone += EvaluateJobOnOnEvaluateDone;
        }
        public RepeaterNode Repeater()
        {
            var newNode = new RepeaterNode();

            this.ChildNodes.Add(newNode);
            return(newNode);
        }
        public override Node Clone(ISharedVariableContainer sharedVariableTable)
        {
            var node = new RepeaterNode(this);

            node.m_Child = m_Child.Clone(sharedVariableTable);

            return(node);
        }
        public RepeaterNode(RepeaterNode other) : base(other)
        {
            m_RepeatTimes = other.m_RepeatTimes;

            m_EndOnFailure = other.m_EndOnFailure;
        }