max power up count
This commit is contained in:
parent
d02100f9a3
commit
2a94a47a96
1 changed files with 7 additions and 1 deletions
|
|
@ -6,9 +6,12 @@ internal sealed class SpawnPowerUp(
|
|||
) : ITickStep
|
||||
{
|
||||
private readonly double _spawnChance = options.Value.PowerUpSpawnChance;
|
||||
private readonly int _maxCount = options.Value.MaxPowerUpCount;
|
||||
|
||||
public Task TickAsync(TimeSpan delta)
|
||||
{
|
||||
if (entityManager.PowerUps.Count() >= _maxCount)
|
||||
return Task.CompletedTask;
|
||||
if (Random.Shared.NextDouble() > _spawnChance * delta.TotalSeconds)
|
||||
return Task.CompletedTask;
|
||||
|
||||
|
|
|
|||
Reference in a new issue