public IEnumerator ContinuousMazeGeneration(bool continuousGeneration) { CreateMazeEntrance(mazeEntrance, mazeEntranceDirection); CreateMazeExit(mazeExit, mazeExitDirection); ma.CreateMaze(); CleanOverlappingMazeWalls(); if (continuousGeneration) { yield return(new WaitForSeconds(secondsBetweenGenerations)); ResetMaze(); StartCoroutine(ContinuousMazeGeneration(true)); } }
public void Start() { stage = new GameObject("Stage"); InitializeMaze(); // Generate rooms GenerateRooms roomsGenerator = new GenerateRooms(); Room room = new Room(); roomsGenerator.CreateRooms(mazeCells, minRooms, maxRooms); room.PersonalizeRoom(mazeCells, floorMaterials); // Generate maze around the rooms to make corridors Maze maze = new MazeAlgorithm(mazeCells, size); maze.CreateMaze(); // Spawn in enemies and the player Spawn sp = new Spawn(); sp.SpawnEnemies(rows, columns, size, enemyPrefab, minEnemies, maxEnemies); sp.SpawnPlayer(playerPrefab); }