move backend to subfolder
This commit is contained in:
parent
d4d1f2f981
commit
8d09663eff
1 changed files with 97 additions and 87 deletions
|
|
@ -1,25 +0,0 @@
|
|||
namespace TanksServer.GameLogic;
|
||||
|
||||
internal sealed class MoveBullets(
|
||||
MapEntityManager entityManager,
|
||||
IOptions<GameRules> config
|
||||
) : ITickStep
|
||||
{
|
||||
public Task TickAsync(TimeSpan delta)
|
||||
{
|
||||
foreach (var bullet in entityManager.Bullets)
|
||||
MoveBullet(bullet, delta);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void MoveBullet(Bullet bullet, TimeSpan delta)
|
||||
{
|
||||
var speed = config.Value.BulletSpeed * delta.TotalSeconds;
|
||||
var angle = bullet.Rotation * 2 * Math.PI;
|
||||
bullet.Position = new FloatPosition(
|
||||
bullet.Position.X + Math.Sin(angle) * speed,
|
||||
bullet.Position.Y - Math.Cos(angle) * speed
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in a new issue