servicepoint-tanks/TanksServer/GameLogic/MapService.cs

43 lines
1.7 KiB
C#
Raw Normal View History

2024-04-10 19:25:45 +02:00
namespace TanksServer.GameLogic;
2024-04-07 13:02:49 +02:00
internal sealed class MapService
{
2024-04-12 18:32:10 +02:00
public const ushort TilesPerRow = 44;
public const ushort TilesPerColumn = 20;
public const ushort TileSize = 8;
public const ushort PixelsPerRow = TilesPerRow * TileSize;
public const ushort PixelsPerColumn = TilesPerColumn * TileSize;
2024-04-06 20:32:54 +02:00
private readonly string _map =
"""
2024-04-12 19:49:24 +02:00
#######.##########################.#########
2024-04-06 20:32:54 +02:00
#...................##.....................#
#...................##.....................#
#.....####......................####.......#
#..........................................#
#............###...........###.............#
#............#...............#.............#
2024-04-12 19:49:24 +02:00
#...##.......#....#....#.....#......##.....#
2024-04-06 20:32:54 +02:00
#....#..............................#......#
2024-04-12 19:49:24 +02:00
.....#...#......................#...#.......
.....#...#......................#...#.......
2024-04-06 20:32:54 +02:00
#....#..............................#......#
2024-04-12 19:49:24 +02:00
#...##.......#....#....#.....#......##.....#
2024-04-06 20:32:54 +02:00
#............#...............#.............#
#............###...........###.............#
#..........................................#
#.....####......................####.......#
#...................##.....................#
#...................##.....................#
2024-04-12 19:49:24 +02:00
#######.##########################.#########
2024-04-06 20:32:54 +02:00
"""
.ReplaceLineEndings(string.Empty);
private char this[int tileX, int tileY] => _map[tileX + tileY * TilesPerRow];
2024-04-07 13:02:49 +02:00
public bool IsCurrentlyWall(TilePosition position)
{
2024-04-07 13:02:49 +02:00
return this[position.X, position.Y] == '#';
}
}