public void loadBTree()
        {
            string text = EditorUtility.OpenFilePanel("Load Behavior Tree", "Assets/Editor/BtreeEditor/Config", "xml");

            if (!string.IsNullOrEmpty(text))
            {
                Debugger.Log("loadBTree");
                BTreeEditorConfig _config = BTreeEditorSerialization.ReadXMLAtPath(text);
                mGraphDesigner = (new BTreeGraphDesigner());
                mGraphDesigner.load(_config);
            }
        }
        public static BTreeEditorConfig CreateBtreeEditorConfigFromGraphDesigner(BTreeGraphDesigner _graphDesigner)
        {
            BTreeEditorConfig _config = new BTreeEditorConfig();

            _config.m_RootNode = CreateEditorTreeConfigFromRootEditorNode(_graphDesigner.m_RootNode);
            _config.m_RootNode.m_IsEnterNode = true;

            _config.m_DetachedNode = new List <BTreeEditorTreeConfig>();
            for (int i = 0; i < _graphDesigner.m_DetachedNodes.Count; i++)
            {
                _config.m_DetachedNode.Add(CreateEditorTreeConfigFromRootEditorNode(_graphDesigner.m_DetachedNodes[i]));
            }
            return(_config);
        }
Esempio n. 3
0
        public void loadBTree(string type)
        {
            string text = EditorUtility.OpenFilePanel("Load Behavior Tree", BTreeEditorSerialization.m_ConfigPath, type);

            if (!string.IsNullOrEmpty(text))
            {
                Debugger.Log("loadBTree:" + type);
                BTreeEditorConfig _config = null;
                if (type == "xml")
                {
                    _config = BTreeEditorSerialization.ReadXMLAtPath(text);
                }
                else if (type == "binary")
                {
                    _config = BTreeEditorSerialization.ReadBinary(text);
                }
                mGraphDesigner = (new BTreeGraphDesigner());
                mGraphDesigner.load(_config);
            }
        }
        public static TreeConfig CreateTreeConfigFromBTreeGraphDesigner(BTreeGraphDesigner _graphDesigner)
        {
            BTreeNode _root = _graphDesigner.m_RootNode.m_EditorNode.m_Node;

            return(BTreeNodeFactory.CreateConfigFromBTreeRoot(_root));
        }