コード例 #1
0
        public void GenerateWorld(Pathfinder pathfinder, bool generateWhileInPlayMode, bool loadCostField)
        {
            Pathfinder = pathfinder;
            float startTime = Time.realtimeSinceStartup;

            TileManager.WorldData = MultiLevelSectorManager.WorldData = HierarchicalPathfinder.WorldData =
                IntegrationFieldManager.WorldData         = FlowFieldManager.WorldData = this;
            MultiLevelSectorManager.LowLevel.Manager      =
                MultiLevelSectorManager.HighLevel.Manager = MultiLevelSectorManager;

            WorldBuilder.GridWidth  = (int)(Pathfinder.worldWidth / Pathfinder.tileSize);
            WorldBuilder.GridLength = (int)(Pathfinder.worldLength / Pathfinder.tileSize);

            WorldBuilder.GenerateWorld(this, generateWhileInPlayMode, loadCostField);

            WorldGenerated = true;
            float endTime     = Time.realtimeSinceStartup;
            float timeElapsed = (endTime - startTime);

            Debug.Log("timeElapsed Generate World ms: " + (timeElapsed * 1000f));
        }
コード例 #2
0
ファイル: WorldData.cs プロジェクト: rainfiel/FlowField
        public void GenerateWorld(Pathfinder _pathfinder, bool GenerateWhileInPlayMode, bool loadCostField)
        {
            pathfinder = _pathfinder;
            float startTime = Time.realtimeSinceStartup;

            tileManager.worldData = multiLevelSectorManager.worldData = hierachalPathfinder.worldData = intergrationFieldManager.worldData = flowFieldManager.worldData = this;
            multiLevelSectorManager.lowLevel.manager = multiLevelSectorManager.highLevel.manager = multiLevelSectorManager;
            worldPositionOffset = new Vector3(0, pathfinder.generationClimbHeight * 0.15f, 0);

            worldBuilder.gridWidth  = (int)(pathfinder.worldWidth / pathfinder.tileSize);
            worldBuilder.gridLength = (int)(pathfinder.worldLength / pathfinder.tileSize);



            worldBuilder.GenerateWorld(this, GenerateWhileInPlayMode, loadCostField);



            worldGenerated = true;
            float endTime     = Time.realtimeSinceStartup;
            float timeElapsed = (endTime - startTime);

            Debug.Log("timeElapsed Generate World ms: " + (timeElapsed * 1000f).ToString());
        }