// Create level from full fragment // _ _ //| | //|_ _| private void levelFull(LevelFragment fullFragment, int x, int y) { //initialize separately from fragmented levels because making a full level is simpler pathfinding = new AStarPathfinding(GRID_SIZE, GRID_SIZE); xPos = x; yPos = y; alive = true; levelOverlayTexture = new Texture2D(RetroGame.graphicsDevice, TEX_SIZE, TEX_SIZE); Color[] data = new Color[TEX_SIZE * TEX_SIZE]; fragmentGrid[0, 0] = fullFragment; fragmentGrid[0, 1] = fullFragment; fragmentGrid[1, 0] = fullFragment; fragmentGrid[1, 1] = fullFragment; grid = (LevelContent.LevelTile[,])fullFragment.grid.Clone(); grid = new LevelContent.LevelTile[GRID_SIZE, GRID_SIZE]; for (int i = 0; i < GRID_SIZE; i++) for (int j = 0; j < GRID_SIZE; j++) { grid[i, j] = fullFragment.grid[i, j]; // cut off last row and column of fragment } collectableLocations = fullFragment.collectableLocations; enemyLocations = fullFragment.enemyLocations; prisonerLocations = fullFragment.prisonerLocations; powerupLocations = fullFragment.powerupLocations; finalizeLevel(); }
// Every level creation does this private void initializeLevel(int x, int y) { pathfinding = new AStarPathfinding(GRID_SIZE, GRID_SIZE); xPos = x; yPos = y; alive = true; levelOverlayTexture = new Texture2D(RetroGame.graphicsDevice, TEX_SIZE, TEX_SIZE); collectableLocations = new List<int[]>(); enemyLocations = new List<int[]>(); prisonerLocations = new List<int[]>(); powerupLocations = new List<int[]>(); }