Esempio n. 1
0
        public void CreateBevTree()
        {
            //m_TreeRoot = BTreeNodeFactory<MyInputData, MyOutputData>.CreateParallelNode(null, "Root_ParallelNode", BTreeParallelFinishCondition.AND);
            //BTreeNodeFactory<MyInputData, MyOutputData>.CreateActionNode<StartActionNode>(m_TreeRoot, "Start");
            //var troopAction = BTreeNodeFactory<MyInputData, MyOutputData>.CreatePrioritySelectorNode(m_TreeRoot, "TroopAction");
            //BTreeNodeFactory<MyInputData, MyOutputData>.CreateActionNode<FindTargetActionNode>(troopAction, "FindTarget")
            //    .SetNodePrecondition(new BTreeNodePreconditionNOT<MyInputData>(new HasTargetCondition()));
            //BTreeNodeFactory<MyInputData, MyOutputData>.CreateActionNode<AttackActionNode>(troopAction, "Attack")
            //    .SetNodePrecondition(new BTreeNodePreconditionAND<MyInputData>(new HasTargetCondition(), new IsInAttackRangeCondition()));
            //BTreeNodeFactory<MyInputData, MyOutputData>.CreateActionNode<MoveToActionNode>(troopAction, "MoveTo")
            //    .SetNodePrecondition(new HasTargetCondition());


            //BTreeNodeSerialization.WriteBinary(config, config.m_Name);
            //var _config = BTreeNodeSerialization.ReadBinary(config.m_Name);

            //BTreeNodeSerialization.WriteXML(config, config.m_Name);
            //var _config = BTreeNodeSerialization.ReadXML("Btree");
            var _config = BTreeNodeSerialization.ReadXML("Btree_test");

            _config = BTreeNodeSerialization.ReadBinary("Root_ParallelNode");

            BTreeNodeFactory.Init();
            m_TreeRoot = BTreeNodeFactory.CreateBTreeRootFromConfig(_config);
            //var _testconfig = BTreeNodeFactory<BTreeInputData, BTreeOutputData>.CreateConfigFromBTreeRoot(m_TreeRoot);
            //BTreeNodeSerialization.WriteXML(_testconfig, "Btree_test");
        }
 public BTreeEditorConfig()
 {
     m_RootNode = new BTreeEditorTreeConfig(BTreeNodeSerialization.ReadXML("Btree"));
     m_RootNode.m_IsEnterNode = true;
     m_RootNode.m_EditorNodes = new BTreeEditorNodeConfig[m_RootNode.m_Nodes.Length];
     for (int i = 0; i < m_RootNode.m_EditorNodes.Length; i++)
     {
         m_RootNode.m_EditorNodes[i]           = new BTreeEditorNodeConfig(m_RootNode.m_Nodes[i]);
         m_RootNode.m_EditorNodes[i].m_PosX    = (i + 1) * 60;
         m_RootNode.m_EditorNodes[i].m_PosY    = (i + 1) * 60;
         m_RootNode.m_EditorNodes[i].m_Disable = false;
     }
 }