Exemplo n.º 1
0
        public static BTNodeDesigner CreateBTreeNodeDesigner(BTEditorNodeConfig[] _configNodes, BTEditorNode[] _editorNodes, ref BTNodeDesigner[] _nodeDesigners, int _index)
        {
            BTEditorNode _editorNode = _editorNodes[_index];

            for (int i = 0; i < _editorNode.mNode.childCount; i++)
            {
                int _childIndex = _editorNode.mNode.children[i].index;
                if (_nodeDesigners[_childIndex] == null)
                {
                    _nodeDesigners[_childIndex] = CreateBTreeNodeDesigner(_configNodes, _editorNodes, ref _nodeDesigners, _childIndex);
                }
            }
            BTNodeDesigner _node = new BTNodeDesigner(_editorNode);

            //_node.m_EditorNode = _editorNode;
            //_node.m_NodeName = _editorNode.m_Node.m_Name;
            //_node.m_ChildNodeList = new List<BTreeNodeDesigner>();
            //_node.m_ChildNodeConnectionList = new List<BTreeNodeConnection>();

            for (int i = 0; i < _editorNode.mNode.childCount; i++)
            {
                int _childIndex = _editorNode.mNode.children[i].index;
                _node.mChildNodeList.Add(_nodeDesigners[_childIndex]);
                BTNodeConnection _connection = new BTNodeConnection(_nodeDesigners[_childIndex], _node, NodeConnectionType.Outgoing);
                _node.mChildNodeConnectionList.Add(_connection);
            }
            return(_node);
        }
Exemplo n.º 2
0
 public BTNodeDesigner(BTEditorNode _editorNode)
 {
     if (_editorNode == null)
     {
         Debugger.Log("BTreeNodeDesigner Init Null");
         return;
     }
     mEditorNode              = _editorNode;
     mChildNodeList           = new List <BTNodeDesigner>();
     mChildNodeConnectionList = new List <BTNodeConnection>();
     LoadTaskIcon();
 }
Exemplo n.º 3
0
 public static BTEditorNode[] CreateBTreeEditorNode(BTEditorTreeConfig _config)
 {
     BTNode[]       _btreeNodes  = BTFactory.CreateBTreeFromConfig(_config);
     BTEditorNode[] _editorNodes = new BTEditorNode[_btreeNodes.Length];
     for (int i = 0; i < _editorNodes.Length; i++)
     {
         _editorNodes[i]          = new BTEditorNode(_btreeNodes[i]);
         _editorNodes[i].mPos     = new Vector2(_config.mEditorNodes[i].mPosX, _config.mEditorNodes[i].mPosY);
         _editorNodes[i].mDisable = _config.mEditorNodes[i].mDisable;
     }
     return(_editorNodes);
 }
Exemplo n.º 4
0
        //添加节点
        public BTNodeDesigner AddNode(Type type, Vector2 position)
        {
            BTNode       _node       = (BTNode)type.GetConstructor(new Type[] { }).Invoke(new object[] { });
            BTEditorNode _editorNode = new BTEditorNode(_node);

            _editorNode.mPos = position;
            BTNodeDesigner _nodeDesigner = new BTNodeDesigner(_editorNode);

            if (mRootNode == null)
            {
                mRootNode = _nodeDesigner;
                _nodeDesigner.SetEntryDisplay(true);
            }
            else
            {
                if (mDetachedNodes == null)
                {
                    mDetachedNodes = new List <BTNodeDesigner>();
                }
                mDetachedNodes.Add(_nodeDesigner);
            }
            return(_nodeDesigner);
        }
Exemplo n.º 5
0
 public void RemoveChildNode(BTEditorNode _node)
 {
     mNode.RemoveChild(_node.mNode);
 }
Exemplo n.º 6
0
 public void AddChildNode(BTEditorNode _node)
 {
     mNode.AddChild(_node.mNode);
 }