/// <summary>
        /// 子节点向自己报告运行状态
        /// </summary>
        public override void onReport(TezBTNode node, Result result)
        {
            switch (result)
            {
            case Result.Success:
                m_Index++;
                if (m_Index == m_List.Count)
                {
                    this.reset();
                    this.report(Result.Success);
                }
                break;

            case Result.Fail:
                this.reset();
                this.report(Result.Fail);
                break;

            case Result.Running:
                break;

            default:
                break;
            }
        }
        public override void onReport(TezBTNode node, Result result)
        {
            m_Index++;
            switch (result)
            {
            case Result.Success:
                m_SuccessCount++;
                m_RunningCount--;
                break;

            case Result.Fail:
                m_FailCount++;
                m_RunningCount--;
                break;

            case Result.Running:
                break;

            default:
                break;
            }

            if (m_RunningCount == 0)
            {
                this.reset();
                if (m_SuccessCount == this.childrenCount)
                {
                    this.report(Result.Success);
                }
                else
                {
                    this.report(Result.Fail);
                }
            }
        }
Exemplo n.º 3
0
 public override void loadConfig(TezReader reader)
 {
     reader.beginObject("Node");
     m_Child = TezBehaviorTree.create(reader.readString("CID"));
     m_Child.loadConfig(reader);
     reader.endObject("Node");
 }
        /// <summary>
        /// 子节点向自己报告运行状态
        /// </summary>
        public override void onReport(TezBTNode node, Result result)
        {
            switch (result)
            {
            case Result.Success:
                ///如果有节点运行成功
                ///像父级报告运行成功
                this.reset();
                this.report(Result.Success);
                break;

            case Result.Fail:
                ///如果有节点运行失败
                ///测试下一个节点
                m_Index++;
                if (m_Index == m_List.Count)
                {
                    this.reset();
                    this.report(Result.Fail);
                }
                break;

            case Result.Running:
                break;

            default:
                break;
            }
        }
 public override void onReport(TezBTNode node, Result result)
 {
     if (result != Result.Running)
     {
         this.reset();
         onTraversalComplete?.Invoke(result);
     }
 }
Exemplo n.º 6
0
        public override void onReport(TezBTNode node, Result result)
        {
            switch (result)
            {
            case Result.Running:
                this.report(Result.Running);
                break;

            default:
                this.report(1 - result);
                break;
            }
        }
Exemplo n.º 7
0
 public override void addNode(TezBTNode node)
 {
     base.addNode(node);
     node.index = m_List.Count;
     m_List.Add(node);
 }
Exemplo n.º 8
0
 public virtual void addNode(TezBTNode node)
 {
     node.tree   = this.tree;
     node.parent = this;
     node.deep   = this.deep + 1;
 }
Exemplo n.º 9
0
 public override void close()
 {
     base.close();
     m_Child = null;
 }
Exemplo n.º 10
0
 public virtual void setChild(TezBTNode node)
 {
     m_Child = node;
 }
 public bool removeRunningNode(TezBTNode node)
 {
     return(m_RunningActionList.Remove(node));
 }
 public void addRunningNode(TezBTNode node)
 {
     m_RunningActionList.Add(node);
 }
Exemplo n.º 13
0
 public virtual void onReport(TezBTNode node, Result result)
 {
 }