fast bullet accelerates instead of being fast immediately
This commit is contained in:
parent
68e61c5204
commit
b1df817ece
|
@ -27,4 +27,6 @@ internal sealed class GameRules
|
||||||
public int ReloadDelayMs { get; set; } = 3000;
|
public int ReloadDelayMs { get; set; } = 3000;
|
||||||
|
|
||||||
public double SmartBulletInertia { get; set; } = 1;
|
public double SmartBulletInertia { get; set; } = 1;
|
||||||
|
|
||||||
|
public double FastBulletAcceleration { get; set; } = 0.25;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ internal sealed class MapEntityManager(
|
||||||
|
|
||||||
public void SpawnBullet(Player tankOwner, FloatPosition position, double rotation, MagazineType type)
|
public void SpawnBullet(Player tankOwner, FloatPosition position, double rotation, MagazineType type)
|
||||||
{
|
{
|
||||||
var speed = _rules.BulletSpeed * (type.HasFlag(MagazineType.Fast) ? 2 : 1);
|
|
||||||
_bullets.Add(new Bullet
|
_bullets.Add(new Bullet
|
||||||
{
|
{
|
||||||
Owner = tankOwner,
|
Owner = tankOwner,
|
||||||
|
@ -26,8 +25,9 @@ internal sealed class MapEntityManager(
|
||||||
IsExplosive = type.HasFlag(MagazineType.Explosive),
|
IsExplosive = type.HasFlag(MagazineType.Explosive),
|
||||||
Timeout = DateTime.Now + _bulletTimeout,
|
Timeout = DateTime.Now + _bulletTimeout,
|
||||||
OwnerCollisionAfter = DateTime.Now + TimeSpan.FromSeconds(1),
|
OwnerCollisionAfter = DateTime.Now + TimeSpan.FromSeconds(1),
|
||||||
Speed = speed,
|
Speed = _rules.BulletSpeed,
|
||||||
IsSmart = type.HasFlag(MagazineType.Smart)
|
IsSmart = type.HasFlag(MagazineType.Smart),
|
||||||
|
Acceleration = type.HasFlag(MagazineType.Fast) ? _rules.FastBulletAcceleration : 0d
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ internal sealed class MoveBullets(
|
||||||
bullet.Rotation += difference * inertiaFactor;
|
bullet.Rotation += difference * inertiaFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bullet.Speed *= 1 + (bullet.Acceleration * delta.TotalSeconds);
|
||||||
|
|
||||||
var speed = bullet.Speed * delta.TotalSeconds;
|
var speed = bullet.Speed * delta.TotalSeconds;
|
||||||
var angle = bullet.Rotation * 2 * Math.PI;
|
var angle = bullet.Rotation * 2 * Math.PI;
|
||||||
bullet.Position = new FloatPosition(
|
bullet.Position = new FloatPosition(
|
||||||
|
|
|
@ -16,7 +16,9 @@ internal sealed class Bullet : IMapEntity
|
||||||
|
|
||||||
internal required DateTime OwnerCollisionAfter { get; init; }
|
internal required DateTime OwnerCollisionAfter { get; init; }
|
||||||
|
|
||||||
public required double Speed { get; init; }
|
public required double Speed { get; set; }
|
||||||
|
|
||||||
|
public required double Acceleration { get; init; }
|
||||||
|
|
||||||
public required bool IsSmart { get; init; }
|
public required bool IsSmart { get; init; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
"SmartBulletHomingSpeed": 1.5
|
"SmartBulletHomingSpeed": 1.5
|
||||||
},
|
},
|
||||||
"Host": {
|
"Host": {
|
||||||
"EnableServicePointDisplay": false,
|
"EnableServicePointDisplay": true,
|
||||||
"ServicePointDisplayMinFrameTimeMs": 28,
|
"ServicePointDisplayMinFrameTimeMs": 28,
|
||||||
"ClientScreenMinFrameTime": 5
|
"ClientScreenMinFrameTime": 5
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue