diff --git a/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs b/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs index 245c718..7bbb49b 100644 --- a/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs +++ b/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs @@ -25,6 +25,7 @@ namespace CounterDrone.Core.Algorithms public float EffectiveRadius => _currentRadius; public ParticleParams Particles { get; } = new(); public bool IsDissipated { get; private set; } + public int Phase => _inPhase3 ? 3 : (_elapsed < 0.01f ? 1 : 2); public void Initialize(AmmunitionSpec ammo, CombatScene env, Vector3 releasePos, float releaseTime) { diff --git a/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs b/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs index 3147dd6..99b97c5 100644 --- a/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs +++ b/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs @@ -13,5 +13,7 @@ namespace CounterDrone.Core.Algorithms float EffectiveRadius { get; } ParticleParams Particles { get; } bool IsDissipated { get; } + /// 当前扩散阶段:1=爆轰膨胀, 2=湍流扩散, 3=高斯扩散 + int Phase { get; } } } diff --git a/src/CounterDrone.Core/Simulation/SimulationEngine.cs b/src/CounterDrone.Core/Simulation/SimulationEngine.cs index 3285d84..ea56da5 100644 --- a/src/CounterDrone.Core/Simulation/SimulationEngine.cs +++ b/src/CounterDrone.Core/Simulation/SimulationEngine.cs @@ -241,7 +241,7 @@ namespace CounterDrone.Core.Simulation foreach (var d in _drones) list.Add(new EntitySnapshot { EntityId = d.Id, EntityType = Models.EntityType.Drone, PosX = d.PosX, PosY = d.PosY, PosZ = d.PosZ, StateData = JsonSerializer.Serialize(new { damageStage = (int)_damageModel.GetDamageStage(1 - d.Hp), 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, StateData = JsonSerializer.Serialize(new { radius = c.Dispersion.Radius, opacity = c.Dispersion.Particles.Opacity }) }); + 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, StateData = JsonSerializer.Serialize(new { radius = c.Dispersion.Radius, opacity = c.Dispersion.Particles.Opacity, phase = c.Dispersion.Phase }) }); return list; } }