Exemplo n.º 1
0
 public Maze(Transform mazeCell, int rows, int cols, MazeGenerator.GenAlgorithm alg)
 {
     this.mazeCell = mazeCell;
     this.rows     = rows;
     this.cols     = cols;
     cells         = new MazeCell[rows, cols];
     this.alg      = GetAlgorithmById(alg);
 }
Exemplo n.º 2
0
    // Create MazeAlgorithm object by enum value
    private MazeAlgorithm GetAlgorithmById(MazeGenerator.GenAlgorithm alg)
    {
        switch (alg)
        {
        case MazeGenerator.GenAlgorithm.MAZE_ALGORITHM_DEPTH_FIRST_SEARCH:
            return(new DepthFirstSearch(rows, cols, ref cells));

        case MazeGenerator.GenAlgorithm.MAZE_ALGORITHM_PRIMS:
            return(new PrimsAlgorithm(rows, cols, ref cells));

        case MazeGenerator.GenAlgorithm.MAZE_ALGORITHM_RECURSIVE_DIVISION:
            return(new RecursiveDivision(rows, cols, ref cells));

        case MazeGenerator.GenAlgorithm.MAZE_ALGORITHM_NONE:
            break;
        }

        return(null);
    }