| | | 1 | | using CounterDrone.Core.Models; |
| | | 2 | | |
| | | 3 | | namespace CounterDrone.Core.Algorithms |
| | | 4 | | { |
| | | 5 | | /// <summary>毁伤模型路由器 — 根据气溶胶类型分派</summary> |
| | | 6 | | public class DamageModelRouter : IDamageModel |
| | | 7 | | { |
| | 14 | 8 | | private readonly InertGasDamageModel _inertGas = new(); |
| | 14 | 9 | | private readonly ActiveMaterialDamageModel _activeMaterial = new(); |
| | 14 | 10 | | private readonly ActiveFuelDamageModel _activeFuel = new(); |
| | | 11 | | |
| | | 12 | | public float CalculateDamage(TargetType droneType, PowerType powerType, |
| | | 13 | | AerosolType aerosolType, float cloudDensity, float exposureTime, float deltaTime) |
| | 28 | 14 | | { |
| | 28 | 15 | | return aerosolType switch |
| | 28 | 16 | | { |
| | 25 | 17 | | AerosolType.InertGas => _inertGas.CalculateDamage(droneType, powerType, aerosolType, cloudDensity, expos |
| | 2 | 18 | | AerosolType.ActiveMaterial => _activeMaterial.CalculateDamage(droneType, powerType, aerosolType, cloudDe |
| | 1 | 19 | | AerosolType.ActiveFuel => _activeFuel.CalculateDamage(droneType, powerType, aerosolType, cloudDensity, e |
| | 0 | 20 | | _ => 0f, |
| | 28 | 21 | | }; |
| | 28 | 22 | | } |
| | | 23 | | |
| | | 24 | | public DamageStage GetDamageStage(float accumulatedDamage) |
| | 5544 | 25 | | { |
| | 5546 | 26 | | if (accumulatedDamage >= 1.0f) return DamageStage.Destroyed; |
| | 5546 | 27 | | if (accumulatedDamage >= 0.6f) return DamageStage.AttitudeLoss; |
| | 5542 | 28 | | if (accumulatedDamage >= 0.25f) return DamageStage.EngineAnomaly; |
| | 5534 | 29 | | return DamageStage.Normal; |
| | 5544 | 30 | | } |
| | | 31 | | } |
| | | 32 | | } |