move backend to subfolder
This commit is contained in:
parent
d4d1f2f981
commit
8d09663eff
80 changed files with 98 additions and 88 deletions
34
tanks-backend/TanksServer/Models/Tank.cs
Normal file
34
tanks-backend/TanksServer/Models/Tank.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System.Diagnostics;
|
||||
using TanksServer.GameLogic;
|
||||
|
||||
namespace TanksServer.Models;
|
||||
|
||||
internal sealed class Tank(Player player, FloatPosition spawnPosition) : IMapEntity
|
||||
{
|
||||
private double _rotation;
|
||||
|
||||
public Player Owner { get; } = player;
|
||||
|
||||
public double Rotation
|
||||
{
|
||||
get => _rotation;
|
||||
set
|
||||
{
|
||||
var newRotation = (value % 1d + 1d) % 1d;
|
||||
Debug.Assert(newRotation is >= 0 and < 1);
|
||||
_rotation = newRotation;
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime NextShotAfter { get; set; }
|
||||
|
||||
public bool Moved { get; set; }
|
||||
|
||||
public FloatPosition Position { get; set; } = spawnPosition;
|
||||
|
||||
public PixelBounds Bounds => Position.GetBoundsForCenter(MapService.TileSize);
|
||||
|
||||
public int Orientation => (int)Math.Round(Rotation * 16) % 16;
|
||||
|
||||
public byte ExplosiveBullets { get; set; }
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue