bullet hits tank, tank dies

This commit is contained in:
Vinzenz Schroeter 2024-04-07 21:09:36 +02:00
commit dd33ec59ad

View file

@ -1,3 +1,5 @@
using TanksServer.Services;
namespace TanksServer.Models;
internal sealed class Tank(Player player, FloatPosition spawnPosition)
@ -16,8 +18,17 @@ internal sealed class Tank(Player player, FloatPosition spawnPosition)
}
public FloatPosition Position { get; set; } = spawnPosition;
public DateTime NextShotAfter { get; set; }
public bool Moved { get; set; }
public (FloatPosition TopLeft, FloatPosition BottomRight) GetBounds()
{
const int halfTile = MapService.TileSize / 2;
return (
new FloatPosition(Position.X - halfTile, Position.Y - halfTile),
new FloatPosition(Position.X + halfTile, Position.Y + halfTile)
);
}
}