Exemplo n.º 1
0
    void Start()
    {
        Stopwatch timer = new Stopwatch();
        timer.Start();
        worldTree = new WorldTree(8);
        //worldTree.ExpandNode(3);

        TestWTI2(30);

        timer.Stop();
           // DumpToFile("WorldTreeDump2.txt");

        DebugOutput.Shout("timer says: " + timer.ElapsedMilliseconds.ToString());

        DebugOutput.Shout("there is " + worldTree.GetIndiceCount().ToString() + " nodes");
        timer.Reset();
        timer.Start();

        TestWTI2(10);
        //DumpToFile("WorldTreeDump.txt");

        //TestWTI2();
        //TestWTI(new Vector3(14, 14,14));

        timer.Stop();
        wti = new WorldTreeInterface(worldTree, transform.position);

        DebugOutput.Shout("timer says: " + timer.ElapsedMilliseconds.ToString());
        DebugOutput.Shout("there is " + worldTree.GetIndiceCount().ToString() + " nodes");

        DumpToFile("WorldTreeDump.txt");
        wti.DumpAllToFile("WTIDump.txt");
    }
Exemplo n.º 2
0
 public WorldTreeInterface(WorldTree source,Vector3 pos)
 {
     sourceTree = source;
     size = Mathf.Pow(2, source.GetMaxLevelDepth());
     position = pos;
     BuildInterfaceFromSource();
     DebugOutput.Shout("maxLevelDepth = " + source.GetMaxLevelDepth().ToString() + " size = " + size.ToString());
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        WorldTree wt = new WorldTree("C:\\Users\\AllenPocket\\Desktop\\TestWTFile.wt");

        Debug.Log("Chunk Count:" + wt.Count);

        wt.Close();
    }
Exemplo n.º 4
0
 public SubPathfinder getSubPathfinder(WorldTree target)
 {
     for (int i = 0; i < subFinders.Count; i++)
     {
         if (subFinders[i].targetTree == target)
         {
             return subFinders[i];
         }
     }
     subFinders.Add(new SubPathfinder(target));
     return subFinders[subFinders.Count - 1];
 }
Exemplo n.º 5
0
        protected override void TestProcedure()
        {
            if (testTree == null)
            {
                ReportFailedTest(TestProcedure);
            }
            else
            {
                masterTree = new WorldTree((sbyte)testMaxDepth);
                RunTest(ValidateTrees);
                RunTest(testTree.internalTest);

            }
        }
Exemplo n.º 6
0
 public static ITree getTreeFromFile(string path,TreeType treeType,  GlobalFlags gf)
 {
     ITree t = null;
         List<ITreeNode> treeNodeList = null;
         switch (treeType)
         {
             case TreeType.World:
                 WorldTree worldTree = new WorldTree(gf, treeType);
                     treeNodeList = getTreeNodeListFromFile(path,treeType);
                    worldTree.treeNodeDictionary = getWorldTreeNodeFromList(treeNodeList);
                    worldTree.currentIndex = treeNodeList[0].index;
                 t = worldTree;
                 break;
             case TreeType.Zone:
                 ZoneTree zoneTree = new ZoneTree(gf, treeType);
                    treeNodeList = getTreeNodeListFromFile(path,treeType);
                    zoneTree.treeNodeDictionary = getZoneTreeNodeFromList(treeNodeList);
                    zoneTree.currentIndex = treeNodeList[0].index;
                    t = zoneTree;
                 break;
             case TreeType.Dialog:
                 DialogTree dialogTree = new DialogTree(gf, treeType);
                     treeNodeList = getTreeNodeListFromFile(path,treeType);
                     dialogTree.treeNodeDictionary = getDialogTreeNodeFromList(treeNodeList);
                     dialogTree.currentIndex = treeNodeList[0].index;
                     t = dialogTree;
                 break;
             case TreeType.Quest:
                 QuestTree questTree = new QuestTree(gf, treeType);
                     treeNodeList = getTreeNodeListFromFile(path,treeType);
                     questTree.treeNodeDictionary = getQuestTreeNodeFromList(treeNodeList);
                     questTree.currentIndex = treeNodeList[0].index;
                     t = questTree;
                 break;
             default:
                 break;
         }
         return t;
 }
Exemplo n.º 7
0
 public static ITree getTreeFromString(string data, TreeType treeType, GlobalFlags gf)
 {
     ITree t = null;
         List<ITreeNode> treeNodeList = null;
         switch (treeType)
         {
             case TreeType.World:
                 WorldTree worldTree = new WorldTree(gf, treeType);
                 treeNodeList = getTreeNodeListFromString(data, treeType);
                 worldTree.treeNodeDictionary = getWorldTreeNodeFromList(treeNodeList);
                 worldTree.currentIndex = treeNodeList[0].index;
                 t = worldTree;
                 break;
             case TreeType.Zone:
                 ZoneTree zoneTree = new ZoneTree(gf, treeType);
                 treeNodeList = getTreeNodeListFromString(data, treeType);
                 zoneTree.treeNodeDictionary = getZoneTreeNodeFromList(treeNodeList);
                 zoneTree.currentIndex = treeNodeList[0].index;
                 t = zoneTree;
                 break;
             case TreeType.Dialog:
                 DialogTree dialogTree = new DialogTree(gf, treeType);
                 treeNodeList = getTreeNodeListFromString(data, treeType);
                 dialogTree.treeNodeDictionary = getDialogTreeNodeFromList(treeNodeList);
                 dialogTree.currentIndex = treeNodeList[0].index;
                 t = dialogTree;
                 break;
             case TreeType.Quest:
                 QuestTree questTree = new QuestTree(gf, treeType);
                 treeNodeList = getTreeNodeListFromString(data, treeType);
                 questTree.treeNodeDictionary = getQuestTreeNodeFromList(treeNodeList);
                 questTree.currentIndex = treeNodeList[0].index;
                 t = questTree;
                 break;
             case TreeType.Battle:
                 BattleTree battleTree = new BattleTree(gf, treeType);
                 treeNodeList = getTreeNodeListFromString(data, treeType);
                 battleTree.treeNodeDictionary = getBattleTreeNodeFromList(treeNodeList);
                 battleTree.currentIndex = treeNodeList[0].index;
                 t = battleTree;
                 break;
             case TreeType.Info:
                 InfoTree infoTree = new InfoTree(gf, treeType);
                 treeNodeList = getTreeNodeListFromString(data, treeType);
                 infoTree.treeNodeDictionary = getInfoTreeNodeFromList(treeNodeList);
                 infoTree.currentIndex = treeNodeList[0].index;
                 t = infoTree;
                 break;
             default:
                 break;
         }
         return t;
 }
Exemplo n.º 8
0
    protected virtual void Init(int wSize)
    {
        worldSize = wSize;
        worldTree = new HybridTree((sbyte)worldSize);
        worldTree.Init();

        discoveryWorkTree = new HybridTree((sbyte)worldSize);
        discoveryWorkTree.Init();

        mainThreadSyncedTree = new WorldTree((sbyte)worldSize);
        mainThreadSyncedTree.Init();

        wtSyncingTree = new WorldTree((sbyte)worldSize);
        wtSyncingTree.Init();

        terrainGenerator = new TerrainGenerator(Mathf.Pow(2, worldSize));
    }
Exemplo n.º 9
0
 protected void SetTestTree(WorldTree tree)
 {
     testTree = tree;
 }
Exemplo n.º 10
0
 void SetMasterTree(WorldTree tree)
 {
     masterTree = tree;
 }
Exemplo n.º 11
0
 public static void RequestPath(WorldTree target,PathDeliverAdress pda,Vector3 from, Vector3 to)
 {
     pathfinder.getSubPathfinder(target).QueuePath(new AIPath(pda, from, to));
 }
Exemplo n.º 12
0
 public SubPathfinder(WorldTree target)
 {
     rwLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
     pathQueue = new List<AIPath>();
     outsideQueue = new List<AIPath>();
     syncedTree = new WorldTree(target.GetMaxLevelDepth());
     targetTree = target;
 }
 private void loadTree()
 {
     int worldIndex = 0; //need to retrieve this from the treeStroe
     gameDataObject.treeStore.SelectTree(worldIndex);
     worldTree = (WorldTree)gameDataObject.treeStore.getCurrentTree();
 }
Exemplo n.º 14
0
    public void SyncTree(WorldTree source)
    {
        if (version == source.GetVersion())
        {
            return;
        }
        else
        {
            if (indices == null)
            {
                indices = new List<sbyte>();

            }
            indices.Clear();
            indices.InsertRange(0,source.indices);
            version = source.GetVersion();
        }
    }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     WorldTree.CreateWT("C:\\Users\\AllenPocket\\Desktop\\TestWTFile.wt");
 }