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 SpawnPowerUp(
IOptions<GameRules> options,
MapEntityManager entityManager
MapEntityManager entityManager,
EmptyTileFinder emptyTileFinder
) : ITickStep
{
private readonly double _spawnChance = options.Value.PowerUpSpawnChance;
@ -34,7 +35,8 @@ internal sealed class SpawnPowerUp(
_ => null
};
entityManager.SpawnPowerUp(type, magazineType);
var position = emptyTileFinder.ChooseEmptyTile().GetCenter().ToFloatPosition();
entityManager.SpawnPowerUp(position, type, magazineType);
return ValueTask.CompletedTask;
}
}