move upgrades to tank, serialize objects directly

This commit is contained in:
Vinzenz Schroeter 2024-05-08 00:29:33 +02:00
parent b1df817ece
commit 827b3a9330
16 changed files with 135 additions and 180 deletions

View file

@ -17,14 +17,15 @@ internal sealed class MoveBullets(
private void MoveBullet(Bullet bullet, TimeSpan delta)
{
if (bullet.IsSmart && TryGetSmartRotation(bullet.Position, bullet.Owner, out var wantedRotation))
if (bullet.Stats.Smart && TryGetSmartRotation(bullet.Position, bullet.Owner, out var wantedRotation))
{
var inertiaFactor = _smartBulletInertia * delta.TotalSeconds;
var difference = wantedRotation - bullet.Rotation;
bullet.Rotation += difference * inertiaFactor;
}
bullet.Speed *= 1 + (bullet.Acceleration * delta.TotalSeconds);
bullet.Speed = double.Clamp(bullet.Speed * (1 + (bullet.Stats.Acceleration * delta.TotalSeconds)), 0d,
MapService.TileSize * 10);
var speed = bullet.Speed * delta.TotalSeconds;
var angle = bullet.Rotation * 2 * Math.PI;