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); }
// 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); }