private void setDungeon()
        {
            organizer                       = new GameObject();
            organizer.name                  = "Dungeon Parts";
            wallOrganizer                   = new GameObject();
            wallOrganizer.name              = "Walls";
            wallOrganizer.transform.parent  = organizer.transform;
            thingOrganizer                  = new GameObject();
            thingOrganizer.name             = "Spawned Objects";
            thingOrganizer.transform.parent = organizer.transform;
            enemyOrganizer                  = new GameObject();
            enemyOrganizer.name             = "Enemies";

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            Debug.Log("Starting floor generation");
            sw.Start();
            Floor.setFloor(this);
            sw.Stop();
            Debug.Log($"Generating floors took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            Debug.Log("Starting wall generation");
            sw.Start();
            Walls.setWalls(this);
            sw.Stop();
            Debug.Log($"Generating walls took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            Debug.Log("Starting object placement");
            sw.Start();
            if (currentDungeonType.spanningTreeTrack.prefab != null)
            {
                Edgewise.generateOnEdges(this, spanningTree, currentDungeonType.spanningTreeTrack.prefab);
            }
            randomizeCells();
            sw.Stop();
            Debug.Log($"Generating objects took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            Debug.Log("Starting portal placement");
            sw.Start();
            Portals.makeDelvePoint(this);
            Portals.makeEscapePoint(this);
            sw.Stop();
            Debug.Log($"Placing portals took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            Debug.Log("Starting enemy placement");
            sw.Start();
            spawnEnemies();
            sw.Stop();
            Debug.Log($"Placing enemies took {sw.ElapsedMilliseconds} ms");
            sw.Reset();
        }
示例#2
0
        /// <summary>
        /// Do all the stuff to make a dungeon
        /// </summary>
        private void setDungeon()
        {
            organizer                       = new GameObject();
            organizer.name                  = "Dungeon Parts";
            wallOrganizer                   = new GameObject();
            wallOrganizer.name              = "Walls";
            wallOrganizer.transform.parent  = organizer.transform;
            thingOrganizer                  = new GameObject();
            thingOrganizer.name             = "Spawned Objects";
            thingOrganizer.transform.parent = organizer.transform;
            enemyOrganizer                  = new GameObject();
            enemyOrganizer.name             = "Enemies";
            cellColliderOrganizer           = new GameObject();
            cellColliderOrganizer.name      = "Cell Triggers";

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            Debug.Log("Starting floor generation");
            sw.Start();
            Floor.setFloor(this);
            sw.Stop();
            Debug.Log($"Generating floors took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            Debug.Log("Starting wall generation");
            sw.Start();
            reachableCells = Walls.setWalls(this);
            sw.Stop();
            Debug.Log($"Generating walls took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            Debug.Log("Starting object placement");
            sw.Start();
            if (currentDungeonType.spanningTreeTrack.prefab != null)
            {
                Edgewise.generateOnEdges(this, spanningTree, currentDungeonType.spanningTreeTrack.prefab);
            }
            randomizeCells();
            sw.Stop();
            Debug.Log($"Generating objects took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            Debug.Log("Starting portal placement");
            sw.Start();
            Portals.makeDelvePoint(this);
            Portals.makeEscapePoint(this);
            sw.Stop();
            Debug.Log($"Placing portals took {sw.ElapsedMilliseconds} ms");
            sw.Reset();

            if (spawnEnemiesDebug || !StateManager.startedFromDungeon)
            {
                Debug.Log("Starting enemy placement");
                sw.Start();
                spawnEnemies();
                sw.Stop();
                Debug.Log($"Placing enemies took {sw.ElapsedMilliseconds} ms");
                sw.Reset();
            }

            navigableDelaunay = new Delaunay(dt, reachableCells);

            Debug.Log("Setting player node collision triggers.");
            setPlayerCollisions();

            Debug.Log("Spawning the debt collector.");
            spawnDebtCollector();
        }