separate tick steps
This commit is contained in:
parent
898a9cedc1
commit
a9aaf899a2
1 changed files with 238 additions and 193 deletions
17
TanksServer/TickSteps/CollideBulletsWithMap.cs
Normal file
17
TanksServer/TickSteps/CollideBulletsWithMap.cs
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in a new issue