// Use this for initialization void Start() { grid = new int[gridWidth, gridHeight]; for (int i = 0; i < gridWidth; i++) { for (int j = 0; j < gridHeight; j++) { grid[i, j] = 0; } } int firstX = gridWidth / 2; int firstY = gridHeight / 2; grid[firstX, firstY] = 1; RoomAdder adder = new RoomAdder(firstX, firstY, grid, numOfRooms); int[] room; while (adder.RoomCount < numOfRooms) { room = RoomAdder.PickRoom(adder.RoomCount, adder.RoomList); NeighborCheck(grid, room[0], room[1], adder); adder.Process(); } displayzors.text = sayArray(); RoomEvaluator eval = new RoomEvaluator(grid, numOfRooms); for (int i = 0; i < gridWidth; i++) { for (int j = 0; j < gridHeight; j++) { if (grid[i, j] != 0) { eval.AddCenter(i, j); NeighborCheck(grid, i, j, eval); eval.Process(); } } } roomify(); }
// Use this for initialization void Start() { grid = new int[gridWidth, gridHeight]; for (int i = 0; i < gridWidth; i++) { for (int j = 0; j < gridHeight; j++) { grid[i, j] = 0; } } int firstX = gridWidth / 2; int firstY = gridHeight / 2; grid[firstX, firstY] = 1; //Begins step 1 RoomAdder adder = new RoomAdder(firstX, firstY, grid, numOfRooms); int[] room;//A two element array that represents a single room while (adder.RoomCount < numOfRooms) { room = RoomAdder.PickRoom(adder.RoomCount, adder.RoomList); NeighborCheck(grid, room[0], room[1], adder); adder.Process(); } //Begins step 2 RoomEvaluator eval = new RoomEvaluator(grid, numOfRooms); //Processes the entire grid for (int i = 0; i < gridWidth; i++) { for (int j = 0; j < gridHeight; j++) { if (grid[i, j] != 0) { eval.AddCenter(i, j); NeighborCheck(grid, i, j, eval); eval.Process(); } } } //begins step 3 roomify(); }