servicepoint-tanks/TanksServer/TickSteps/CollideBulletsWithMap.cs

20 lines
483 B
C#
Raw Normal View History

2024-04-07 19:52:16 +02:00
using TanksServer.Helpers;
2024-04-07 20:16:22 +02:00
using TanksServer.Models;
using TanksServer.Services;
2024-04-07 19:52:16 +02:00
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());
}
}