예제 #1
0
			public TileMap(string mapDataAsString)
			{
				if (String.IsNullOrWhiteSpace(mapDataAsString))
					throw new NoTileMapData();
				string[] tileLines = mapDataAsString.SplitAndTrim(Environment.NewLine);
				mapData = new CompleteSquare[tileLines.Length * tileLines[0].Length];
				size = new Size(tileLines[0].Length, tileLines.Length);
				for (int lineIndex = 0; lineIndex < Height; lineIndex++)
					for (int symbolIndex = 0; symbolIndex < Width; symbolIndex++)
					{
						var index = symbolIndex + lineIndex * Width;
						mapData[index] = new CompleteSquare(tileLines[lineIndex][symbolIndex]);
					}
			}
예제 #2
0
 public TileMap(string mapDataAsString)
 {
     if (String.IsNullOrWhiteSpace(mapDataAsString))
     {
         throw new NoTileMapData();
     }
     string[] tileLines = mapDataAsString.SplitAndTrim(Environment.NewLine);
     mapData = new CompleteSquare[tileLines.Length * tileLines[0].Length];
     size    = new Size(tileLines[0].Length, tileLines.Length);
     for (int lineIndex = 0; lineIndex < Height; lineIndex++)
     {
         for (int symbolIndex = 0; symbolIndex < Width; symbolIndex++)
         {
             var index = symbolIndex + lineIndex * Width;
             mapData[index] = new CompleteSquare(tileLines[lineIndex][symbolIndex]);
         }
     }
 }
예제 #3
0
			public TileMap(CompleteSquare[] mapData, Size size)
			{
				this.mapData = mapData;
				this.size = size;
			}