private void GenerateMapInEditor() { if (_mapGenerator.transform.childCount > 0) { ClearMapInEditor(); } _isBaked = false; _mapGenerator.SpawnMaze(); }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (!isSawn) { startPointX = UnityEngine.Random.Range(0, Width - 1); startPointY = UnityEngine.Random.Range(0, Height - 1); mazeSpawner.SpawnMaze(); isSawn = true; } }
private void LoadLevel() { ResetPlayerStatsAndPosition(); UpdateMazeSize(); DestroyOldMaze(); maze.SpawnMaze(); DisplayNewLevelOnUI(); }
void CreateMaze(int rows, int columns) { if (currentMaze != null) { Destroy(currentMaze); } mazeNodes = new MazeNode[rows, columns]; currentMaze = Instantiate(MazePrefab); spawner = currentMaze.GetComponent <MazeSpawner>(); spawner.OnMazeCellCreated += HandleGridCreation; spawner.Rows = rows; spawner.Columns = columns; spawner.RandomSeed = UnityEngine.Random.Range(0, 999999); spawner.SpawnMaze(); OnNewMazeSize?.Invoke(rows, columns); OnNewMazeSpawner?.Invoke(spawner); }