Пример #1
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public override ActionResult Excute(BTInput input)
        {
            base.Excute(input);

            for (int i = this.m_iRuningIndex; i < this.m_listChildren.Count; i++)
            {
                BNode        node = this.m_listChildren[i];
                ActionResult res  = node.RunNode(input);
                if (res == ActionResult.Running)
                {
                    this.m_iRuningIndex = i;
                    return(ActionResult.Running);
                }
            }
            return(ActionResult.Success);
            //if (this.m_iRuningIndex >= this.m_listChildren.Count)
            //{
            //    return ActionResult.Success;
            //}

            //BNode node = this.m_listChildren[this.m_iRuningIndex];

            //ActionResult res = node.RunNode(input);

            //if (res != ActionResult.Running)
            //{
            //    this.m_iRuningIndex++;
            //}

            //return ActionResult.Running;
        }
Пример #2
0
        public override ActionResult Excute(BTInput input)
        {
            base.Excute(input);
            if (this.m_listChildren.Count == 0)
            {
                return(ActionResult.Success);
            }

            BNode        node = this.m_listChildren[0];
            ActionResult res  = node.RunNode(input);

            return(res);
        }