private void Destroy(MapSpace space) { if (space.obstacle != null) { DestroyImmediate(space.obstacle); space.obstacle = null; space.isObstacle = false; } }
// Generates a maze starting at x, y with width w and height h, and cellSize. Pass in map as ref to keep track of objects and stack size to indicate how many recursions private void GenerateMazeScuffedRecursiveDiv(int x, int y, int w, int h, int cellSize, ref MapSpace[,] map, int stackSize) { for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { map[i, j] = new MapSpace(x + i, y + j); } } GenerateMazeScuffedRecursiveDivHelper(x, y, w, h, cellSize, ref map, stackSize, 0); }