separate tick steps

This commit is contained in:
Vinzenz Schroeter 2024-04-07 19:52:16 +02:00
commit a9aaf899a2

View file

@ -0,0 +1,17 @@
using TanksServer.Helpers;
namespace TanksServer.TickSteps;
internal sealed class CollideBulletsWithMap(BulletManager bullets, MapService map) : ITickStep
{
public Task TickAsync()
{
bullets.RemoveWhere(BulletHitsWall);
return Task.CompletedTask;
}
private bool BulletHitsWall(Bullet bullet)
{
return map.IsCurrentlyWall(bullet.Position.ToPixelPosition().ToTilePosition());
}
}