public RandomDungeon GenerateDungeon(RoomSet roomSet, RandomDungeonGenerationData generationData)
        {
            mRNG = new System.Random(generationData.randomSeed);

            mRoomSet = roomSet;

            while (mMapInvalid)
            {
                PrepareNewMapGeneration();

                ConstructPrimaryPath(generationData.scopeData);

                CollectAvailableExits(ForbiddenScopesForExtraRooms(generationData.scopeData));
                AddExtraRooms(generationData.numExtraRoomsPlacedBeforeSpecialRooms);

                CollectAvailableExits(ForbiddenScopesForSpecialRooms(generationData.scopeData));
                AddSpecialRooms(generationData.minSpecialRooms, generationData.maxSpecialRooms);

                CollectAvailableExits(ForbiddenScopesForExtraRooms(generationData.scopeData));
                AddExtraRooms(generationData.numExtraRoomsPlacedAfterSpecialRooms);

                if (mMapInvalid)
                {
                    mGenerationRequiredRetry = true;
                    mCurrentTileId           = 1;
                }
            }

            return(GenerateRandomDungeonFromCurrentProgress(generationData));
        }
        /// <summary>
        /// Given the current progress of map generation, generates a random dungeon.
        /// This is only exposed as public for demonstration purposes when we want to show the
        /// dungeon being generated dynamically.
        /// </summary>
        /// <param name="generationData"></param>
        /// <returns></returns>
        public RandomDungeon GenerateRandomDungeonFromCurrentProgress(RandomDungeonGenerationData generationData, Dictionary <Vector2Int, RandomDungeonTileData> scratch = null)
        {
            RandomDungeon dungeon = GenerateDungeonObjectFromScratchPad(scratch != null ? scratch : mRoomScratch);

            CloseExitsToNowhere(dungeon);

            if (generationData.enforceTwoTileHighWalls)
            {
                EnforceWallHeight(dungeon);
            }

            if (generationData.fillEmptyCellsWithWalls)
            {
                FillEmptyCellsWithWalls(dungeon);
            }

            return(dungeon);
        }