bullet hits tank, tank dies
This commit is contained in:
parent
190c0c3143
commit
dd33ec59ad
6 changed files with 45 additions and 9 deletions
|
@ -2,7 +2,7 @@ namespace TanksServer.Models;
|
|||
|
||||
internal sealed class Bullet(Player tankOwner, FloatPosition position, double rotation)
|
||||
{
|
||||
public Player TankOwner { get; } = tankOwner;
|
||||
public Player Owner { get; } = tankOwner;
|
||||
|
||||
public FloatPosition Position { get; set; } = position;
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ internal sealed class Player(string name)
|
|||
public Guid Id { get; } = Guid.NewGuid();
|
||||
|
||||
public PlayerControls Controls { get; } = new();
|
||||
|
||||
public int Kills { get; set; }
|
||||
|
||||
public int Deaths { get; set; }
|
||||
}
|
||||
|
||||
internal sealed class PlayerControls
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue