42 lines
2 KiB
C#
42 lines
2 KiB
C#
![]() |
namespace TanksServer;
|
||
|
|
||
|
public class MapService
|
||
|
{
|
||
|
public const int TilesPerRow = 44;
|
||
|
public const int TilesPerColumn = 20;
|
||
|
public const int TileSize = 8;
|
||
|
public const int PixelsPerRow = TilesPerRow * TileSize;
|
||
|
public const int PixelsPerColumn = TilesPerColumn * TileSize;
|
||
|
|
||
|
private string _map = """
|
||
|
############################################
|
||
|
#...................##.....................#
|
||
|
#...................##.....................#
|
||
|
#.....####......................####.......#
|
||
|
#..........................................#
|
||
|
#............###...........###.............#
|
||
|
#............#...............#.............#
|
||
|
#...##.......#...............#......##.....#
|
||
|
#....#..............................#......#
|
||
|
#....#..##......................##..#......#
|
||
|
#....#..##......................##..#......#
|
||
|
#....#..............................#......#
|
||
|
#...##.......#...............#......##.....#
|
||
|
#............#...............#.............#
|
||
|
#............###...........###.............#
|
||
|
#..........................................#
|
||
|
#.....####......................####.......#
|
||
|
#...................##.....................#
|
||
|
#...................##.....................#
|
||
|
############################################
|
||
|
"""
|
||
|
.ReplaceLineEndings(string.Empty);
|
||
|
|
||
|
private char this[int tileX, int tileY] => _map[tileX + tileY * TilesPerRow];
|
||
|
|
||
|
public bool IsCurrentlyWall(int tileX, int tileY)
|
||
|
{
|
||
|
return this[tileX, tileY] == '#';
|
||
|
}
|
||
|
}
|