merge options
This commit is contained in:
		
							parent
							
								
									9cf4304845
								
							
						
					
					
						commit
						043022186f
					
				
					 10 changed files with 28 additions and 40 deletions
				
			
		|  | @ -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; } | ||||
| } | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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) | ||||
|     { | ||||
|  |  | |||
|  | @ -1,8 +0,0 @@ | |||
| namespace TanksServer.GameLogic; | ||||
| 
 | ||||
| public class PlayersConfiguration | ||||
| { | ||||
|     public int SpawnDelayMs { get; set; } | ||||
| 
 | ||||
|     public int IdleTimeoutMs { get; set; } | ||||
| } | ||||
|  | @ -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) | ||||
|     { | ||||
|  |  | |||
|  | @ -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 _) | ||||
|     { | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis; | |||
| namespace TanksServer.GameLogic; | ||||
| 
 | ||||
| internal sealed class TankSpawnQueue( | ||||
|     IOptions<PlayersConfiguration> options, | ||||
|     IOptions<GameRules> options, | ||||
|     MapEntityManager entityManager | ||||
| ): ITickStep | ||||
| { | ||||
|  |  | |||
|  | @ -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; } | ||||
| } | ||||
|  | @ -86,10 +86,6 @@ public static class Program | |||
|         builder.Services.AddSingleton<IFrameConsumer, ClientScreenServer>(sp => | ||||
|             sp.GetRequiredService<ClientScreenServer>()); | ||||
| 
 | ||||
|         builder.Services.Configure<TanksConfiguration>( | ||||
|             builder.Configuration.GetSection("Tanks")); | ||||
|         builder.Services.Configure<PlayersConfiguration>( | ||||
|             builder.Configuration.GetSection("Players")); | ||||
|         builder.Services.Configure<GameRules>(builder.Configuration.GetSection("GameRules")); | ||||
| 
 | ||||
|         if (hostConfiguration.EnableServicePointDisplay) | ||||
|  |  | |||
|  | @ -19,24 +19,21 @@ | |||
|         "Hostname": "172.23.42.29", | ||||
|         "Port": 2342 | ||||
|     }, | ||||
|     "Tanks": { | ||||
|     "GameRules": { | ||||
|         "DestructibleWalls": true, | ||||
|         "PowerUpSpawnChance": 0.1, | ||||
|         "MaxPowerUpCount": 15, | ||||
|         "BulletTimeoutMs": 30000, | ||||
|         "SpawnDelayMs": 3000, | ||||
|         "IdleTimeoutMs": 30000, | ||||
|         "MoveSpeed": 37.5, | ||||
|         "TurnSpeed": 0.5, | ||||
|         "ShootDelayMs": 450, | ||||
|         "BulletSpeed": 75 | ||||
|     }, | ||||
|     "GameRules": { | ||||
|         "DestructibleWalls": true, | ||||
|         "PowerUpSpawnChance": 0.1, | ||||
|         "MaxPowerUpCount": 15 | ||||
|     }, | ||||
|     "Players": { | ||||
|         "SpawnDelayMs": 3000, | ||||
|         "IdleTimeoutMs": 30000 | ||||
|     }, | ||||
|     "Host": { | ||||
|         "EnableServicePointDisplay": true, | ||||
|         "ServicePointDisplayMinFrameTimeMs": 25, | ||||
|         "ServicePointDisplayMinFrameTimeMs": 28, | ||||
|         "ClientScreenMinFrameTime": 5 | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter