implement fast bullets
This commit is contained in:
parent
9ccb7c8df8
commit
9164d90443
7 changed files with 30 additions and 24 deletions
|
@ -1,9 +1,6 @@
|
|||
namespace TanksServer.GameLogic;
|
||||
|
||||
internal sealed class MoveBullets(
|
||||
MapEntityManager entityManager,
|
||||
IOptions<GameRules> config
|
||||
) : ITickStep
|
||||
internal sealed class MoveBullets(MapEntityManager entityManager) : ITickStep
|
||||
{
|
||||
public ValueTask TickAsync(TimeSpan delta)
|
||||
{
|
||||
|
@ -13,9 +10,9 @@ internal sealed class MoveBullets(
|
|||
return ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
private void MoveBullet(Bullet bullet, TimeSpan delta)
|
||||
private static void MoveBullet(Bullet bullet, TimeSpan delta)
|
||||
{
|
||||
var speed = config.Value.BulletSpeed * delta.TotalSeconds;
|
||||
var speed = bullet.Speed * delta.TotalSeconds;
|
||||
var angle = bullet.Rotation * 2 * Math.PI;
|
||||
bullet.Position = new FloatPosition(
|
||||
bullet.Position.X + Math.Sin(angle) * speed,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue