From bb0a2454df1fcd7721c38e742a7b500811cb8125 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Fri, 12 Jun 2026 14:21:32 +0800 Subject: [PATCH] =?UTF-8?q?ICloudDispersionModel=E5=8A=A0Phase=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=20+=20=E5=B8=A7=E6=95=B0=E6=8D=AE=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=89=A9=E6=95=A3=E9=98=B6=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs | 1 + src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs | 2 ++ src/CounterDrone.Core/Simulation/SimulationEngine.cs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) 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; } }