make big display toggleable
This commit is contained in:
parent
a9aaf899a2
commit
dc9ad21a3d
1 changed files with 119 additions and 46 deletions
|
|
@ -1,14 +1,13 @@
|
|||
using System.Collections.Concurrent;
|
||||
using TanksServer.Models;
|
||||
using TanksServer.Services;
|
||||
|
||||
namespace TanksServer.TickSteps;
|
||||
|
||||
internal sealed class SpawnNewTanks(TankManager tanks, MapService map) : ITickStep
|
||||
internal sealed class SpawnNewTanks(TankManager tanks, MapService map, SpawnQueueProvider queueProvider) : ITickStep
|
||||
{
|
||||
private readonly ConcurrentQueue<Player> _playersToSpawn = new();
|
||||
|
||||
public Task TickAsync()
|
||||
{
|
||||
while (_playersToSpawn.TryDequeue(out var player))
|
||||
while (queueProvider.Queue.TryDequeue(out var player))
|
||||
{
|
||||
var tank = new Tank(player, ChooseSpawnPosition())
|
||||
{
|
||||
|
|
@ -42,9 +41,4 @@ internal sealed class SpawnNewTanks(TankManager tanks, MapService map) : ITickSt
|
|||
chosenTile.Y * MapService.TileSize
|
||||
);
|
||||
}
|
||||
|
||||
public void SpawnTankForPlayer(Player player)
|
||||
{
|
||||
_playersToSpawn.Enqueue(player);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue