Пример #1
0
 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();
 }
Пример #2
0
 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();
             }
         }
     }
 }
Пример #3
0
 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();
 }