merge options

This commit is contained in:
Vinzenz Schroeter 2024-04-19 13:37:28 +02:00
parent 9cf4304845
commit 043022186f
10 changed files with 28 additions and 40 deletions

View file

@ -9,4 +9,16 @@ internal sealed class GameRules
public int MaxPowerUpCount { get; set; } = int.MaxValue;
public int BulletTimeoutMs { get; set; } = int.MaxValue;
public double MoveSpeed { get; set; }
public double TurnSpeed { get; set; }
public double ShootDelayMs { get; set; }
public double BulletSpeed { get; set; }
public int SpawnDelayMs { get; set; }
public int IdleTimeoutMs { get; set; }
}

View file

@ -2,7 +2,7 @@ namespace TanksServer.GameLogic;
internal sealed class MoveBullets(
MapEntityManager entityManager,
IOptions<TanksConfiguration> config
IOptions<GameRules> config
) : ITickStep
{
public Task TickAsync(TimeSpan delta)

View file

@ -2,11 +2,11 @@ namespace TanksServer.GameLogic;
internal sealed class MoveTanks(
MapEntityManager entityManager,
IOptions<TanksConfiguration> options,
IOptions<GameRules> options,
MapService map
) : ITickStep
{
private readonly TanksConfiguration _config = options.Value;
private readonly GameRules _config = options.Value;
public Task TickAsync(TimeSpan delta)
{

View file

@ -1,8 +0,0 @@
namespace TanksServer.GameLogic;
public class PlayersConfiguration
{
public int SpawnDelayMs { get; set; }
public int IdleTimeoutMs { get; set; }
}

View file

@ -2,11 +2,11 @@ namespace TanksServer.GameLogic;
internal sealed class RotateTanks(
MapEntityManager entityManager,
IOptions<TanksConfiguration> options,
IOptions<GameRules> options,
ILogger<RotateTanks> logger
) : ITickStep
{
private readonly TanksConfiguration _config = options.Value;
private readonly GameRules _config = options.Value;
public Task TickAsync(TimeSpan delta)
{

View file

@ -3,11 +3,11 @@ using System.Diagnostics;
namespace TanksServer.GameLogic;
internal sealed class ShootFromTanks(
IOptions<TanksConfiguration> options,
IOptions<GameRules> options,
MapEntityManager entityManager
) : ITickStep
{
private readonly TanksConfiguration _config = options.Value;
private readonly GameRules _config = options.Value;
public Task TickAsync(TimeSpan _)
{

View file

@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
namespace TanksServer.GameLogic;
internal sealed class TankSpawnQueue(
IOptions<PlayersConfiguration> options,
IOptions<GameRules> options,
MapEntityManager entityManager
): ITickStep
{

View file

@ -1,9 +0,0 @@
namespace TanksServer.GameLogic;
public class TanksConfiguration
{
public double MoveSpeed { get; set; }
public double TurnSpeed { get; set; }
public double ShootDelayMs { get; set; }
public double BulletSpeed { get; set; }
}