servicepoint-tanks/TanksServer/Services/MapService.cs

45 lines
1.8 KiB
C#
Raw Normal View History

2024-04-07 13:02:49 +02:00
using TanksServer.Models;
2024-04-07 11:19:14 +02:00
namespace TanksServer.Services;
2024-04-07 13:02:49 +02:00
internal sealed 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;
2024-04-06 20:32:54 +02:00
private readonly string _map =
"""
############################################
#...................##.....................#
#...................##.....................#
#.....####......................####.......#
#..........................................#
#............###...........###.............#
#............#...............#.............#
#...##.......#...............#......##.....#
#....#..............................#......#
#....#..##......................##..#......#
#....#..##......................##..#......#
#....#..............................#......#
#...##.......#...............#......##.....#
#............#...............#.............#
#............###...........###.............#
#..........................................#
#.....####......................####.......#
#...................##.....................#
#...................##.....................#
############################################
"""
.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] == '#';
}
}