Example #1
0
 private void GenerateMapInEditor()
 {
     if (_mapGenerator.transform.childCount > 0)
     {
         ClearMapInEditor();
     }
     _isBaked = false;
     _mapGenerator.SpawnMaze();
 }
Example #2
0
 // 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;
     }
 }
Example #3
0
    private void LoadLevel()
    {
        ResetPlayerStatsAndPosition();

        UpdateMazeSize();

        DestroyOldMaze();

        maze.SpawnMaze();

        DisplayNewLevelOnUI();
    }
Example #4
0
    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);
    }