improve spawn position checks

This commit is contained in:
Vinzenz Schroeter 2024-04-11 20:48:21 +02:00
parent 91ab911f9c
commit ad211433fb
16 changed files with 147 additions and 80 deletions

View file

@ -1,10 +1,10 @@
namespace TanksServer.Models;
internal sealed class Bullet(Player tankOwner, FloatPosition position, double rotation)
internal sealed class Bullet(Player tankOwner, FloatPosition position, double rotation): IMapEntity
{
public Player Owner { get; } = tankOwner;
public FloatPosition Position { get; set; } = position;
public double Rotation { get; set; } = rotation;
}
}

View file

@ -1,5 +1,3 @@
namespace TanksServer.Models;
internal readonly record struct FloatPosition(double X, double Y)
{
}
internal readonly record struct FloatPosition(double X, double Y);

View file

@ -0,0 +1,7 @@
namespace TanksServer.Models;
internal interface IMapEntity
{
FloatPosition Position { get; set; }
double Rotation { get; set; }
}

View file

@ -2,7 +2,7 @@ using TanksServer.GameLogic;
namespace TanksServer.Models;
internal sealed class Tank(Player player, FloatPosition spawnPosition)
internal sealed class Tank(Player player, FloatPosition spawnPosition): IMapEntity
{
private double _rotation;

View file

@ -1,9 +0,0 @@
namespace TanksServer.Models;
public class TanksConfiguration
{
public double MoveSpeed { get; set; } = 1.4;
public double TurnSpeed { get; set; } = 0.4;
public double ShootDelayMs { get; set; } = 0.4 * 1000;
public double BulletSpeed { get; set; } = 8;
}