wall collision
This commit is contained in:
parent
54b840da3e
commit
dd6b0fffc1
6 changed files with 68 additions and 39 deletions
|
@ -1,3 +1,8 @@
|
|||
using TanksServer.Services;
|
||||
|
||||
namespace TanksServer.Models;
|
||||
|
||||
internal record struct FloatPosition(double X, double Y);
|
||||
internal readonly record struct FloatPosition(double X, double Y)
|
||||
{
|
||||
public PixelPosition ToPixelPosition() => new((int)X % MapService.PixelsPerRow, (int)Y % MapService.PixelsPerRow);
|
||||
}
|
||||
|
|
|
@ -3,13 +3,16 @@ namespace TanksServer.Models;
|
|||
internal sealed class Tank(Player player, FloatPosition spawnPosition)
|
||||
{
|
||||
private double _rotation;
|
||||
|
||||
|
||||
public Player Owner { get; } = player;
|
||||
|
||||
/// <summary>
|
||||
/// Bounds: 0 (inclusive) .. 16 (exclusive)
|
||||
/// </summary>
|
||||
public double Rotation
|
||||
{
|
||||
get => _rotation;
|
||||
set => _rotation = value % 16d;
|
||||
set => _rotation = (value + 16d) % 16d;
|
||||
}
|
||||
|
||||
public FloatPosition Position { get; set; } = spawnPosition;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue