From 2697225aff254e0e007c4eeff60f56496946d09e Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Thu, 11 Jun 2026 16:48:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20.editorconfig=20+=20dotnet?= =?UTF-8?q?=20format=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 19 ++++++ .../Algorithms/AlgorithmFactory.cs | 4 +- .../Algorithms/DefaultDefenseAdvisor.cs | 3 +- .../Algorithms/ICloudDispersionModel.cs | 2 +- .../Algorithms/IDamageModel.cs | 2 +- .../Algorithms/IDefenseAdvisor.cs | 2 +- .../Services/IModelService.cs | 2 +- .../Services/IReportService.cs | 2 +- .../Services/IScenarioService.cs | 2 +- .../Services/ReportService.cs | 5 +- .../Simulation/SimulationEngine.cs | 51 ++++++++++----- test/reports/喷气拦截_20260611_084809.md | 47 ++++++++++++++ test/reports/活塞拦截_20260611_084812.md | 46 +++++++++++++ .../AlgorithmFactoryTests.cs | 6 +- .../AmmunitionSpecRepositoryTests.cs | 9 ++- .../CounterDrone.Core.Tests/EdgeCaseTests.cs | 22 +++++-- .../FullPipelineTests.cs | 64 ++++++++++++++----- .../ScenarioServiceTests.cs | 4 +- .../SimulationEngineTests.cs | 26 ++++++-- 19 files changed, 255 insertions(+), 63 deletions(-) create mode 100644 .editorconfig create mode 100644 test/reports/喷气拦截_20260611_084809.md create mode 100644 test/reports/活塞拦截_20260611_084812.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..405ca39 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.cs] +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_space_after_cast = false +csharp_space_after_keywords_in_control_flow_statements = true diff --git a/src/CounterDrone.Core/Algorithms/AlgorithmFactory.cs b/src/CounterDrone.Core/Algorithms/AlgorithmFactory.cs index b4bb48a..b6b9d5a 100644 --- a/src/CounterDrone.Core/Algorithms/AlgorithmFactory.cs +++ b/src/CounterDrone.Core/Algorithms/AlgorithmFactory.cs @@ -9,8 +9,8 @@ namespace CounterDrone.Core.Algorithms private static readonly Dictionary> _registry = new() { [typeof(ICloudDispersionModel)] = () => new GaussianPuffDispersion(), - [typeof(IDamageModel)] = () => new DamageModelRouter(), - [typeof(IDefenseAdvisor)] = () => new DefaultDefenseAdvisor(null), + [typeof(IDamageModel)] = () => new DamageModelRouter(), + [typeof(IDefenseAdvisor)] = () => new DefaultDefenseAdvisor(null), }; public static void Register(Func factory) diff --git a/src/CounterDrone.Core/Algorithms/DefaultDefenseAdvisor.cs b/src/CounterDrone.Core/Algorithms/DefaultDefenseAdvisor.cs index b043100..4ee504d 100644 --- a/src/CounterDrone.Core/Algorithms/DefaultDefenseAdvisor.cs +++ b/src/CounterDrone.Core/Algorithms/DefaultDefenseAdvisor.cs @@ -167,7 +167,8 @@ namespace CounterDrone.Core.Algorithms { AerosolType = (int)aerosolType, PositionX = start.X + (end.X - start.X) * 0.25f, - PositionY = start.Y, PositionZ = start.Z, + PositionY = start.Y, + PositionZ = start.Z, DisperseHeight = (float)target.TypicalAltitude, Duration = (int)maxDur, Source = "Algorithm", diff --git a/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs b/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs index d224495..3147dd6 100644 --- a/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs +++ b/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs @@ -3,7 +3,7 @@ using CounterDrone.Core.Models; namespace CounterDrone.Core.Algorithms { /// 云团扩散模型接口 -public interface ICloudDispersionModel + public interface ICloudDispersionModel { void Initialize(AmmunitionSpec ammo, CombatScene env, Vector3 releasePos, float releaseTime); void Tick(float deltaTime, float windSpeed, WindDirection windDir); diff --git a/src/CounterDrone.Core/Algorithms/IDamageModel.cs b/src/CounterDrone.Core/Algorithms/IDamageModel.cs index 72c16f1..a75a101 100644 --- a/src/CounterDrone.Core/Algorithms/IDamageModel.cs +++ b/src/CounterDrone.Core/Algorithms/IDamageModel.cs @@ -3,7 +3,7 @@ using CounterDrone.Core.Models; namespace CounterDrone.Core.Algorithms { /// 毁伤模型接口 -public interface IDamageModel + public interface IDamageModel { float CalculateDamage(TargetType droneType, PowerType powerType, AerosolType aerosolType, float cloudDensity, float exposureTime, float deltaTime); diff --git a/src/CounterDrone.Core/Algorithms/IDefenseAdvisor.cs b/src/CounterDrone.Core/Algorithms/IDefenseAdvisor.cs index 0ce6308..7e31ed4 100644 --- a/src/CounterDrone.Core/Algorithms/IDefenseAdvisor.cs +++ b/src/CounterDrone.Core/Algorithms/IDefenseAdvisor.cs @@ -3,7 +3,7 @@ using CounterDrone.Core.Models; namespace CounterDrone.Core.Algorithms { /// 防御推荐接口 — 威胁驱动 -public interface IDefenseAdvisor + public interface IDefenseAdvisor { DefenseRecommendation Recommend(ThreatProfile threat); } diff --git a/src/CounterDrone.Core/Services/IModelService.cs b/src/CounterDrone.Core/Services/IModelService.cs index c631c0d..2f5d630 100644 --- a/src/CounterDrone.Core/Services/IModelService.cs +++ b/src/CounterDrone.Core/Services/IModelService.cs @@ -4,7 +4,7 @@ using CounterDrone.Core.Models; namespace CounterDrone.Core.Services { /// 模型管理服务 — 3D 模型的导入、删除、查询 -public interface IModelService + public interface IModelService { ModelInfo ImportModel(string filePath, string name); void DeleteModel(string id); diff --git a/src/CounterDrone.Core/Services/IReportService.cs b/src/CounterDrone.Core/Services/IReportService.cs index d1e083a..b25558d 100644 --- a/src/CounterDrone.Core/Services/IReportService.cs +++ b/src/CounterDrone.Core/Services/IReportService.cs @@ -5,7 +5,7 @@ using SimEvent = CounterDrone.Core.Simulation.SimEvent; namespace CounterDrone.Core.Services { /// 报告服务 -public interface IReportService + public interface IReportService { SimulationReport Generate(string taskId, TaskFullConfig config, List events, string finalDroneStatus, float duration); diff --git a/src/CounterDrone.Core/Services/IScenarioService.cs b/src/CounterDrone.Core/Services/IScenarioService.cs index 994c05a..8257c01 100644 --- a/src/CounterDrone.Core/Services/IScenarioService.cs +++ b/src/CounterDrone.Core/Services/IScenarioService.cs @@ -4,7 +4,7 @@ using CounterDrone.Core.Models; namespace CounterDrone.Core.Services { /// 想定管理服务 -public interface IScenarioService + public interface IScenarioService { SimTask CreateTask(string name, string taskNumber); void DeleteTask(string id); diff --git a/src/CounterDrone.Core/Services/ReportService.cs b/src/CounterDrone.Core/Services/ReportService.cs index 7b51475..1d8d4bc 100644 --- a/src/CounterDrone.Core/Services/ReportService.cs +++ b/src/CounterDrone.Core/Services/ReportService.cs @@ -74,7 +74,10 @@ namespace CounterDrone.Core.Services return new PagedResult { - Items = items, TotalCount = total, Page = page, PageSize = pageSize, + Items = items, + TotalCount = total, + Page = page, + PageSize = pageSize, }; } diff --git a/src/CounterDrone.Core/Simulation/SimulationEngine.cs b/src/CounterDrone.Core/Simulation/SimulationEngine.cs index a29fbd0..3a65d10 100644 --- a/src/CounterDrone.Core/Simulation/SimulationEngine.cs +++ b/src/CounterDrone.Core/Simulation/SimulationEngine.cs @@ -20,7 +20,7 @@ namespace CounterDrone.Core.Simulation /// 仿真引擎 — 纯执行器,不包含任何决策逻辑 /// 仿真引擎 — 纯执行器,接收发射计划按时间表执行 -public class SimulationEngine + public class SimulationEngine { private readonly IScenarioService _scenarioService; private readonly FrameDataStore _frameStore; @@ -162,8 +162,10 @@ public class SimulationEngine _munitions.Add(m); frameEvents.Add(new SimEvent { - Type = SimEventType.MunitionLaunched, OccurredAt = SimulationTime, - SourceId = platform.Id, Description = $"计划发射 {m.Id}", + Type = SimEventType.MunitionLaunched, + OccurredAt = SimulationTime, + SourceId = platform.Id, + Description = $"计划发射 {m.Id}", }); } } @@ -181,7 +183,8 @@ public class SimulationEngine _munitions.Remove(m); frameEvents.Add(new SimEvent { - Type = SimEventType.CloudGenerated, OccurredAt = SimulationTime, + Type = SimEventType.CloudGenerated, + OccurredAt = SimulationTime, Description = $"云团生成", }); } @@ -209,8 +212,10 @@ public class SimulationEngine if (drone.Status == DroneStatus.Destroyed) frameEvents.Add(new SimEvent { - Type = SimEventType.DroneDestroyed, OccurredAt = SimulationTime, - TargetId = drone.Id, Description = $"无人机 {drone.Id} 被摧毁", + Type = SimEventType.DroneDestroyed, + OccurredAt = SimulationTime, + TargetId = drone.Id, + Description = $"无人机 {drone.Id} 被摧毁", }); } } @@ -223,8 +228,10 @@ public class SimulationEngine if (drone.Status == DroneStatus.ReachedTarget) frameEvents.Add(new SimEvent { - Type = SimEventType.DroneReachedTarget, OccurredAt = SimulationTime, - SourceId = drone.Id, Description = "到达攻击目标", + Type = SimEventType.DroneReachedTarget, + OccurredAt = SimulationTime, + SourceId = drone.Id, + Description = "到达攻击目标", }); } @@ -241,8 +248,11 @@ public class SimulationEngine drone.MarkZoneIntruded(); frameEvents.Add(new SimEvent { - Type = SimEventType.ZoneIntruded, OccurredAt = SimulationTime, - SourceId = drone.Id, TargetId = zone.Id, Description = $"侵入 {zone.Name}", + Type = SimEventType.ZoneIntruded, + OccurredAt = SimulationTime, + SourceId = drone.Id, + TargetId = zone.Id, + Description = $"侵入 {zone.Name}", }); } } @@ -264,8 +274,11 @@ public class SimulationEngine return new SimulationFrameResult { - EntitySnapshots = snapshots, NewEvents = frameEvents, - State = State, FrameIndex = FrameIndex, SimulationTime = SimulationTime, + EntitySnapshots = snapshots, + NewEvents = frameEvents, + State = State, + FrameIndex = FrameIndex, + SimulationTime = SimulationTime, }; } @@ -281,16 +294,22 @@ public class SimulationEngine var stage = _damageModel.GetDamageStage(1 - d.Hp); list.Add(new EntitySnapshot { - EntityId = d.Id, EntityType = Models.EntityType.Drone, - PosX = d.PosX, PosY = d.PosY, PosZ = d.PosZ, + EntityId = d.Id, + EntityType = Models.EntityType.Drone, + PosX = d.PosX, + PosY = d.PosY, + PosZ = d.PosZ, StateData = JsonSerializer.Serialize(new { damageStage = (int)stage, hp = d.Hp }), }); } foreach (var c in _clouds) list.Add(new EntitySnapshot { - EntityId = c.Id, EntityType = Models.EntityType.Cloud, - PosX = c.Dispersion.Center.X, PosY = c.Dispersion.Center.Y, PosZ = c.Dispersion.Center.Z, + EntityId = c.Id, + EntityType = Models.EntityType.Cloud, + PosX = c.Dispersion.Center.X, + PosY = c.Dispersion.Center.Y, + PosZ = c.Dispersion.Center.Z, StateData = JsonSerializer.Serialize(new { radius = c.Dispersion.Radius, opacity = c.Dispersion.Particles.Opacity }), }); return list; diff --git a/test/reports/喷气拦截_20260611_084809.md b/test/reports/喷气拦截_20260611_084809.md new file mode 100644 index 0000000..1d24d50 --- /dev/null +++ b/test/reports/喷气拦截_20260611_084809.md @@ -0,0 +1,47 @@ +# 仿真评估报告 + +**任务名称**:喷气拦截 +**任务编号**:SIM-20260611-004 +**仿真耗时**:106.4 秒 + +## 一、仿真前 — 我方配置 + +| 配置项 | 值 | +|--------|-----| +| 目标数量 | 1 | +| 发射平台 | 6 台 | +| 探测设备 | 1 台 | +| 气溶胶类型 | ActiveMaterial | + +## 二、仿真中 — 关键事件时序 + +| 时间(s) | 事件 | 描述 | +|---------|------|------| +| 92.2 | MunitionLaunched | 计划发射 mun_1 | +| 92.2 | MunitionLaunched | 计划发射 mun_2 | +| 92.2 | MunitionLaunched | 计划发射 mun_3 | +| 92.2 | MunitionLaunched | 计划发射 mun_4 | +| 92.2 | MunitionLaunched | 计划发射 mun_5 | +| 92.2 | MunitionLaunched | 计划发射 mun_6 | +| 101.8 | CloudGenerated | 云团生成 | +| 101.8 | CloudGenerated | 云团生成 | +| 101.8 | CloudGenerated | 云团生成 | +| 101.8 | CloudGenerated | 云团生成 | +| 101.8 | CloudGenerated | 云团生成 | +| 101.8 | CloudGenerated | 云团生成 | +| 106.4 | DroneDestroyed | 无人机 drone_1 被摧毁 | +| 106.4 | SimulationEnd | | + +## 三、仿真后 — 数据统计 + +| 统计项 | 值 | +|--------|-----| +| 无人机总数 | 1 | +| 被摧毁 | 1 | +| 到达目标 | 0 | +| 侵入管控区 | 0 | +| 弹药发射次数 | 6 | +| 云团生成次数 | 6 | + +**对抗结果**:成功拦截 + diff --git a/test/reports/活塞拦截_20260611_084812.md b/test/reports/活塞拦截_20260611_084812.md new file mode 100644 index 0000000..7bfa144 --- /dev/null +++ b/test/reports/活塞拦截_20260611_084812.md @@ -0,0 +1,46 @@ +# 仿真评估报告 + +**任务名称**:活塞拦截 +**任务编号**:SIM-20260611-041 +**仿真耗时**:185.6 秒 + +## 一、仿真前 — 我方配置 + +| 配置项 | 值 | +|--------|-----| +| 目标数量 | 1 | +| 发射平台 | 5 台 | +| 探测设备 | 1 台 | +| 气溶胶类型 | InertGas | + +## 二、仿真中 — 关键事件时序 + +| 时间(s) | 事件 | 描述 | +|---------|------|------| +| 167.4 | MunitionLaunched | 计划发射 mun_1 | +| 167.4 | MunitionLaunched | 计划发射 mun_2 | +| 167.4 | MunitionLaunched | 计划发射 mun_3 | +| 167.4 | MunitionLaunched | 计划发射 mun_4 | +| 167.4 | MunitionLaunched | 计划发射 mun_5 | +| 177.0 | CloudGenerated | 云团生成 | +| 177.0 | CloudGenerated | 云团生成 | +| 177.0 | CloudGenerated | 云团生成 | +| 177.0 | CloudGenerated | 云团生成 | +| 177.0 | CloudGenerated | 云团生成 | +| 185.6 | DroneDestroyed | 无人机 drone_1 被摧毁 | +| 185.6 | DroneDestroyed | 无人机 drone_1 被摧毁 | +| 185.6 | SimulationEnd | | + +## 三、仿真后 — 数据统计 + +| 统计项 | 值 | +|--------|-----| +| 无人机总数 | 1 | +| 被摧毁 | 2 | +| 到达目标 | 0 | +| 侵入管控区 | 0 | +| 弹药发射次数 | 5 | +| 云团生成次数 | 5 | + +**对抗结果**:成功拦截 + diff --git a/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs b/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs index 38afe8c..5bae74d 100644 --- a/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs +++ b/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs @@ -38,8 +38,10 @@ namespace CounterDrone.Core.Tests public bool IsDissipated => false; public void Initialize(CounterDrone.Core.Models.AmmunitionSpec ammo, - CounterDrone.Core.Models.CombatScene env, Vector3 releasePos, float releaseTime) { } + CounterDrone.Core.Models.CombatScene env, Vector3 releasePos, float releaseTime) + { } public void Tick(float deltaTime, float windSpeed, - CounterDrone.Core.Models.WindDirection windDir) { } + CounterDrone.Core.Models.WindDirection windDir) + { } } } diff --git a/test/unit/CounterDrone.Core.Tests/AmmunitionSpecRepositoryTests.cs b/test/unit/CounterDrone.Core.Tests/AmmunitionSpecRepositoryTests.cs index 2e27813..a5f9d82 100644 --- a/test/unit/CounterDrone.Core.Tests/AmmunitionSpecRepositoryTests.cs +++ b/test/unit/CounterDrone.Core.Tests/AmmunitionSpecRepositoryTests.cs @@ -61,15 +61,18 @@ namespace CounterDrone.Core.Tests { _repo.Insert(new AmmunitionSpec { - Name = "Inert-A", AerosolType = (int)AerosolType.InertGas + Name = "Inert-A", + AerosolType = (int)AerosolType.InertGas }); _repo.Insert(new AmmunitionSpec { - Name = "Inert-B", AerosolType = (int)AerosolType.InertGas + Name = "Inert-B", + AerosolType = (int)AerosolType.InertGas }); _repo.Insert(new AmmunitionSpec { - Name = "Active-A", AerosolType = (int)AerosolType.ActiveMaterial + Name = "Active-A", + AerosolType = (int)AerosolType.ActiveMaterial }); var inertSpecs = _repo.GetByAerosolType((int)AerosolType.InertGas); diff --git a/test/unit/CounterDrone.Core.Tests/EdgeCaseTests.cs b/test/unit/CounterDrone.Core.Tests/EdgeCaseTests.cs index 9f586bb..4197969 100644 --- a/test/unit/CounterDrone.Core.Tests/EdgeCaseTests.cs +++ b/test/unit/CounterDrone.Core.Tests/EdgeCaseTests.cs @@ -28,9 +28,13 @@ namespace CounterDrone.Core.Tests _db.Insert(new AmmunitionSpec { - AerosolType = (int)AerosolType.InertGas, InitialRadius = 50, - CoreDensity = 1.0, DispersionRateBase = 5, MaxRadius = 500, - MaxDuration = 120, EffectiveConcentration = 0.05, + AerosolType = (int)AerosolType.InertGas, + InitialRadius = 50, + CoreDensity = 1.0, + DispersionRateBase = 5, + MaxRadius = 500, + MaxDuration = 120, + EffectiveConcentration = 0.05, }); _scenario = new ScenarioService( @@ -55,8 +59,10 @@ namespace CounterDrone.Core.Tests _scenario.SaveScene(_taskId, new CombatScene { WindSpeed = 0 }); _scenario.SaveTarget(_taskId, new TargetConfig { - TargetType = (int)TargetType.Piston, Quantity = 1, - TypicalSpeed = 100, TypicalAltitude = 300, + TargetType = (int)TargetType.Piston, + Quantity = 1, + TypicalSpeed = 100, + TypicalAltitude = 300, }); _scenario.SaveDeployment(_taskId, new List()); _scenario.SaveCloudDispersal(_taskId, new CloudDispersal()); @@ -95,7 +101,8 @@ namespace CounterDrone.Core.Tests }); _scenario.SaveTarget(_taskId, new TargetConfig { - TargetType = (int)TargetType.Piston, Quantity = 1, + TargetType = (int)TargetType.Piston, + Quantity = 1, TypicalSpeed = 600, // 高速对抗强风 }); _scenario.SaveDeployment(_taskId, new List()); @@ -132,7 +139,8 @@ namespace CounterDrone.Core.Tests _scenario.SaveScene(_taskId, new CombatScene { WindSpeed = 0 }); _scenario.SaveTarget(_taskId, new TargetConfig { - TargetType = (int)TargetType.HighSpeed, Quantity = 1, + TargetType = (int)TargetType.HighSpeed, + Quantity = 1, TypicalSpeed = 500, }); _scenario.SaveDeployment(_taskId, new List()); diff --git a/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs b/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs index 24273d7..dbee625 100644 --- a/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs +++ b/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs @@ -32,23 +32,38 @@ namespace CounterDrone.Core.Tests _mainDb.Insert(new AmmunitionSpec { - Id = "ammo-inert", AerosolType = (int)AerosolType.InertGas, - Name = "惰性气体弹", InitialRadius = 50, CoreDensity = 1.0, - DispersionRateBase = 5, MaxRadius = 500, MaxDuration = 120, + Id = "ammo-inert", + AerosolType = (int)AerosolType.InertGas, + Name = "惰性气体弹", + InitialRadius = 50, + CoreDensity = 1.0, + DispersionRateBase = 5, + MaxRadius = 500, + MaxDuration = 120, EffectiveConcentration = 0.05, }); _mainDb.Insert(new AmmunitionSpec { - Id = "ammo-active", AerosolType = (int)AerosolType.ActiveMaterial, - Name = "活性材料弹", InitialRadius = 30, CoreDensity = 2.0, - DispersionRateBase = 3, MaxRadius = 400, MaxDuration = 90, + Id = "ammo-active", + AerosolType = (int)AerosolType.ActiveMaterial, + Name = "活性材料弹", + InitialRadius = 30, + CoreDensity = 2.0, + DispersionRateBase = 3, + MaxRadius = 400, + MaxDuration = 90, EffectiveConcentration = 0.1, }); _mainDb.Insert(new AmmunitionSpec { - Id = "ammo-fuel", AerosolType = (int)AerosolType.ActiveFuel, - Name = "活性燃料弹", InitialRadius = 40, CoreDensity = 1.5, - DispersionRateBase = 4, MaxRadius = 450, MaxDuration = 100, + Id = "ammo-fuel", + AerosolType = (int)AerosolType.ActiveFuel, + Name = "活性燃料弹", + InitialRadius = 40, + CoreDensity = 1.5, + DispersionRateBase = 4, + MaxRadius = 450, + MaxDuration = 100, EffectiveConcentration = 0.03, }); @@ -150,7 +165,9 @@ namespace CounterDrone.Core.Tests { FireTime = fireTime, PlatformIndex = r % platforms.Count, - TargetX = tx, TargetY = ty, TargetZ = tz, + TargetX = tx, + TargetY = ty, + TargetZ = tz, MuzzleVelocity = muzzleV, }); } @@ -193,7 +210,9 @@ namespace CounterDrone.Core.Tests { EquipmentRole = (int)EquipmentRole.Detection, Quantity = d.Quantity, - PositionX = d.Position.X, PositionY = d.Position.Y, PositionZ = d.Position.Z, + PositionX = d.Position.X, + PositionY = d.Position.Y, + PositionZ = d.Position.Z, DetectionRadius = d.DetectionRadius, }); foreach (var p in rec.Best.Platforms) @@ -202,7 +221,9 @@ namespace CounterDrone.Core.Tests EquipmentRole = (int)EquipmentRole.LaunchPlatform, PlatformType = (int)p.Type, Quantity = p.Quantity, - PositionX = p.Position.X, PositionY = p.Position.Y, PositionZ = p.Position.Z, + PositionX = p.Position.X, + PositionY = p.Position.Y, + PositionZ = p.Position.Z, AerosolType = (int)rec.Best.RecommendedAerosolType, MunitionCount = p.MunitionCount, Cooldown = p.Cooldown, @@ -243,7 +264,9 @@ namespace CounterDrone.Core.Tests { TargetType = (int)TargetType.FixedWing, PowerType = (int)PowerType.Jet, - Quantity = 1, TypicalSpeed = 600, TypicalAltitude = 400, + Quantity = 1, + TypicalSpeed = 600, + TypicalAltitude = 400, }); _scenario.SaveRoute(_taskId, new RoutePlan { FormationMode = (int)FormationMode.Single }, new List @@ -273,7 +296,9 @@ namespace CounterDrone.Core.Tests { TargetType = (int)TargetType.Electric, PowerType = (int)PowerType.Electric, - Quantity = 1, TypicalSpeed = 300, TypicalAltitude = 300, + Quantity = 1, + TypicalSpeed = 300, + TypicalAltitude = 300, }); _scenario.SaveRoute(_taskId, new RoutePlan { FormationMode = (int)FormationMode.Single }, new List @@ -309,13 +334,16 @@ namespace CounterDrone.Core.Tests _scenario.SaveScene(_taskId, new CombatScene { - WindSpeed = 3, WindDirection = (int)WindDirection.W, + WindSpeed = 3, + WindDirection = (int)WindDirection.W, }); _scenario.SaveTarget(_taskId, new TargetConfig { TargetType = (int)TargetType.Piston, PowerType = (int)PowerType.Piston, - Quantity = 1, TypicalSpeed = 200, TypicalAltitude = 500, + Quantity = 1, + TypicalSpeed = 200, + TypicalAltitude = 500, }); _scenario.SaveRoute(_taskId, new RoutePlan { FormationMode = (int)FormationMode.Single }, new List @@ -380,7 +408,9 @@ namespace CounterDrone.Core.Tests { TargetType = (int)TargetType.HighSpeed, PowerType = (int)PowerType.Jet, - Quantity = 1, TypicalSpeed = 500, TypicalAltitude = 800, + Quantity = 1, + TypicalSpeed = 500, + TypicalAltitude = 800, }); _scenario.SaveRoute(_taskId, new RoutePlan { FormationMode = (int)FormationMode.Single }, new List diff --git a/test/unit/CounterDrone.Core.Tests/ScenarioServiceTests.cs b/test/unit/CounterDrone.Core.Tests/ScenarioServiceTests.cs index 599fbf5..3becff0 100644 --- a/test/unit/CounterDrone.Core.Tests/ScenarioServiceTests.cs +++ b/test/unit/CounterDrone.Core.Tests/ScenarioServiceTests.cs @@ -426,7 +426,9 @@ namespace CounterDrone.Core.Tests AerosolType = (int)AerosolType.ActiveMaterial, TriggerMode = (int)TriggerMode.Area, Duration = 50.0, - PositionX = 3000, PositionY = 0, PositionZ = 300, + PositionX = 3000, + PositionY = 0, + PositionZ = 300, }); _service.UpdateStep(task.Id, 4); diff --git a/test/unit/CounterDrone.Core.Tests/SimulationEngineTests.cs b/test/unit/CounterDrone.Core.Tests/SimulationEngineTests.cs index bcbecb2..c54f13d 100644 --- a/test/unit/CounterDrone.Core.Tests/SimulationEngineTests.cs +++ b/test/unit/CounterDrone.Core.Tests/SimulationEngineTests.cs @@ -30,9 +30,14 @@ namespace CounterDrone.Core.Tests _mainDb.Insert(new AmmunitionSpec { - AerosolType = (int)AerosolType.InertGas, Name = "Test Ammo", - InitialRadius = 50, CoreDensity = 1.0, DispersionRateBase = 5, - MaxRadius = 500, MaxDuration = 120, EffectiveConcentration = 0.05, + AerosolType = (int)AerosolType.InertGas, + Name = "Test Ammo", + InitialRadius = 50, + CoreDensity = 1.0, + DispersionRateBase = 5, + MaxRadius = 500, + MaxDuration = 120, + EffectiveConcentration = 0.05, }); _scenarioService = new ScenarioService( @@ -59,8 +64,10 @@ namespace CounterDrone.Core.Tests _scenarioService.SaveScene(_taskId, new CombatScene { WindSpeed = 0 }); _scenarioService.SaveTarget(_taskId, new TargetConfig { - TargetType = (int)TargetType.Piston, Quantity = 1, - PowerType = (int)PowerType.Piston, TypicalSpeed = 60, + TargetType = (int)TargetType.Piston, + Quantity = 1, + PowerType = (int)PowerType.Piston, + TypicalSpeed = 60, }); _scenarioService.SaveDeployment(_taskId, new List { @@ -74,8 +81,13 @@ namespace CounterDrone.Core.Tests }); _scenarioService.SaveCloudDispersal(_taskId, new CloudDispersal { - AerosolType = (int)AerosolType.InertGas, DisperseHeight = 300, Duration = 60, - RecommendedTiming = 10, PositionX = 1000, PositionY = 300, PositionZ = 0, + AerosolType = (int)AerosolType.InertGas, + DisperseHeight = 300, + Duration = 60, + RecommendedTiming = 10, + PositionX = 1000, + PositionY = 300, + PositionZ = 0, PositionMode = (int)PositionMode.AlgorithmRecommended, }); _scenarioService.SaveRoute(_taskId, new RoutePlan { FormationMode = (int)FormationMode.Single },