Exemple #1
0
        public void SetCurrentTree(GBTNode tree)
        {
            _bb.SetInt("bbIdleCnt", 3);
            _root = tree;
            _root.Transition();

            _root.SetBB(_bb);
            _root.SetKey("root:" + tree.ToString());
        }
        // 优先级,越大优先级越高
        public CTR_PrioritizedSelector Add(GBTNode child, int weight)
        {
            int index = _children.Count;

            if (null != Add(child))
            {
                _indexPriority.Add(index, weight);
            }
            return(this);
        }
Exemple #3
0
 public GBTCtrNode Add(GBTNode child)
 {
     if (_maxChild <= _children.Count)
     {
         return(null);
     }
     _children.Add(child);
     child.SetParent(this);
     child.SetBB(_bb);
     return(this);
 }
Exemple #4
0
        public void SwitchTo(GBTNode tree)
        {
            if (null == tree)
            {
                return;
            }

            if (_root != null)
            {
                _root.Transition();
            }

            SetCurrentTree(tree);
        }
Exemple #5
0
 public GBehaviorTree()
 {
     _bb   = new BlackBoard();
     _root = null;
 }
Exemple #6
0
 public void SetParent(GBTNode parent)
 {
     _parent = parent;
     SetKey(parent.GetKey());
 }
Exemple #7
0
 public GBTNode()
 {
     _state  = ENodeState.init;
     _parent = null;
 }