reposition tanks on map switch, rework map logic

This commit is contained in:
Vinzenz Schroeter 2024-05-03 15:47:33 +02:00 committed by RobbersDaughter
parent 3d65c81b8b
commit 97144ae3b8
13 changed files with 208 additions and 117 deletions

View file

@ -4,7 +4,8 @@ namespace TanksServer.GameLogic;
internal sealed class TankSpawnQueue(
IOptions<GameRules> options,
MapEntityManager entityManager
MapEntityManager entityManager,
EmptyTileFinder tileFinder
) : ITickStep
{
private readonly ConcurrentQueue<Player> _queue = new();
@ -25,7 +26,8 @@ internal sealed class TankSpawnQueue(
if (!TryDequeueNext(out var player))
return ValueTask.CompletedTask;
entityManager.SpawnTank(player);
var position = tileFinder.ChooseEmptyTile().GetCenter().ToFloatPosition();
entityManager.SpawnTank(player, position);
return ValueTask.CompletedTask;
}