separate folders per functionality
This commit is contained in:
parent
7f00160780
commit
0ca6a91a7e
1 changed files with 60 additions and 113 deletions
42
TanksServer/GameLogic/MapService.cs
Normal file
42
TanksServer/GameLogic/MapService.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
namespace TanksServer.GameLogic;
|
||||
|
||||
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;
|
||||
|
||||
private readonly string _map =
|
||||
"""
|
||||
############################################
|
||||
#...................##.....................#
|
||||
#...................##.....................#
|
||||
#.....####......................####.......#
|
||||
#..........................................#
|
||||
#............###...........###.............#
|
||||
#............#...............#.............#
|
||||
#...##.......#...............#......##.....#
|
||||
#....#..............................#......#
|
||||
#....#..##......................##..#......#
|
||||
#....#..##......................##..#......#
|
||||
#....#..............................#......#
|
||||
#...##.......#...............#......##.....#
|
||||
#............#...............#.............#
|
||||
#............###...........###.............#
|
||||
#..........................................#
|
||||
#.....####......................####.......#
|
||||
#...................##.....................#
|
||||
#...................##.....................#
|
||||
############################################
|
||||
"""
|
||||
.ReplaceLineEndings(string.Empty);
|
||||
|
||||
private char this[int tileX, int tileY] => _map[tileX + tileY * TilesPerRow];
|
||||
|
||||
public bool IsCurrentlyWall(TilePosition position)
|
||||
{
|
||||
return this[position.X, position.Y] == '#';
|
||||
}
|
||||
}
|
||||
Reference in a new issue