コード例 #1
0
ファイル: TileFactory.cs プロジェクト: pchaigno/smallworld
 /// <summary>
 /// Converts a matrix of tiles to a matrix of integers with the corresponding numbers.
 /// </summary>
 /// <param name="tiles">The map as a matrix of tiles.</param>
 /// <returns>The map as a matrix of integers.</returns>
 public static int[][] GetNumbers(ITile[,] tiles)
 {
     int[][] map = new int[tiles.GetLength(0)][];
     for(int i = 0; i < tiles.GetLength(0); i++) {
         map[i] = new int[tiles.GetLength(1)];
         for(int j = 0; j < tiles.GetLength(1); j++) {
             map[i][j] = tiles[i, j].Number;
         }
     }
     return map;
 }