public void LoadRoom() { roomTiles = new Tile[level.roomWidth, level.roomHeight]; for (int x = 0; x < level.roomWidth; x++) { int columnHeight = level.levelNoise.GetNoise(((int)levelPos.x * level.roomWidth * ((int)levelPos.y + 1)) + x, 10); int columnTop = 1 + level.levelNoise.GetNoise(((int)levelPos.x * level.roomWidth * ((int)levelPos.y + 1)) + x, 7); for (int y = 0; y < level.roomHeight; y++) { if (y == columnHeight || y == level.roomHeight - columnTop) { roomTiles[x, y] = new TileGrass(); } else if (y <= columnHeight || y >= level.roomHeight - columnTop) { roomTiles[x, y] = new TileGround(); } else { roomTiles[x, y] = new TileVoid(); } } } UpdateRoom(); }
private void GenerateTiles(int[,] roomData) { roomTiles = new Tile[levelManager.roomWidth, levelManager.roomHeight]; for (int x = 0; x < levelManager.roomWidth; x++) { for (int y = 0; y < levelManager.roomHeight; y++) { if (roomData[x, y] == 0) { roomTiles[x, y] = new TileVoid(); } else { roomTiles[x, y] = new Tile(); } } } }
public void SetChunkData(int xChunk, int yChunk, int[,] levelData) { chunkTiles = new Tile[chunkSize, chunkSize]; for (int x = 0; x < chunkSize; x++) { for (int y = 0; y < chunkSize; y++) { if (levelData[xChunk * chunkSize + x, yChunk *chunkSize + chunkSize - y - 1] == 1) { chunkTiles[x, y] = new Tile(); } else { chunkTiles[x, y] = new TileVoid(); } } } UpdateChunk(); }