Ejemplo n.º 1
0
 public static BTNodeDesigner[] CreateBTreeNodeDesignerFromConfig(BTEditorTreeConfig _config)
 {
     BTNodeDesigner[] _nodeDesigners = new BTNodeDesigner[_config.mEditorNodes.Length];
     BTEditorNode[]   _editorNodes   = CreateBTreeEditorNode(_config);
     //递归创建节点
     for (int i = 0; i < _nodeDesigners.Length; i++)
     {
         if (_nodeDesigners[i] == null)
         {
             _nodeDesigners[i] = CreateBTreeNodeDesigner(_config.mEditorNodes, _editorNodes, ref _nodeDesigners, i);
         }
     }
     //初始化父节点与连线
     for (int i = 0; i < _nodeDesigners.Length; i++)
     {
         var _editorNode = _editorNodes[i];
         if (_editorNode.mNode.parent != null)
         {
             int _parentIndex = _editorNode.mNode.parent.index;
             _nodeDesigners[i].mParentNode = _nodeDesigners[_parentIndex];
             BTNodeConnection _connection = new BTNodeConnection(_nodeDesigners[i], _nodeDesigners[_parentIndex], NodeConnectionType.Incoming);
             _nodeDesigners[i].mParentNodeConnection = _connection;
         }
     }
     return(_nodeDesigners);
 }
Ejemplo n.º 2
0
        public static BTEditorTreeConfig CreateEditorTreeConfigFromRootEditorNode(BTNodeDesigner _rootEditorNode)
        {
            TreeConfig         _treeConfig       = BTFactory.CreateConfigFromBTreeRoot(_rootEditorNode.mEditorNode.mNode);
            BTEditorTreeConfig _treeEditorConfig = new BTEditorTreeConfig(_treeConfig);
            int index = 0;

            CreateEditorNodeConfigFromRootEditorNode(_rootEditorNode, ref _treeEditorConfig.mEditorNodes, ref index);

            return(_treeEditorConfig);
        }
Ejemplo 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);
 }