Пример #1
0
 public Board(SpriteBatch spritebatch, Texture2D tileTexture, int columns, int rows)
 {
     Columns = columns;
     Rows = rows;
     TileTexture = tileTexture;
     SpriteBatch = spritebatch;
     Tiles = new Tile[Columns, Rows];
     InitializeAllTilesAndBlockSomeRandomly();
     SetAllBorderTilesBlocked();
 }
Пример #2
0
 private void InitializeAllTilesAndBlockSomeRandomly()
 {
     for (int x = 0; x < Columns; x++)
     {
         for (int y = 0; y < Rows; y++)
         {
             Vector2 tilePosition = new Vector2(x * TileTexture.Width, y * TileTexture.Height);
             Tiles[x, y] = new Tile(TileTexture, tilePosition, SpriteBatch, _rnd.Next(5) == 0);
         }
     }
 }