From 3e12dba1437e37d8738e65875147a6d16771f435 Mon Sep 17 00:00:00 2001
From: tian <11429339@qq.com>
Date: Fri, 12 Jun 2026 14:25:23 +0800
Subject: [PATCH] =?UTF-8?q?ICloudDispersionModel=E5=8A=A0Elapsed=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?=E4=BA=91=E5=9B=A2=E5=AD=98=E5=9C=A8=E6=97=B6=E9=97=B4?=
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 +-
test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs | 1 +
4 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs b/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs
index 7bbb49b..1e3e554 100644
--- a/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs
+++ b/src/CounterDrone.Core/Algorithms/GaussianPuffDispersion.cs
@@ -26,6 +26,7 @@ namespace CounterDrone.Core.Algorithms
public ParticleParams Particles { get; } = new();
public bool IsDissipated { get; private set; }
public int Phase => _inPhase3 ? 3 : (_elapsed < 0.01f ? 1 : 2);
+ public float Elapsed => _elapsed;
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 99b97c5..014307e 100644
--- a/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs
+++ b/src/CounterDrone.Core/Algorithms/ICloudDispersionModel.cs
@@ -15,5 +15,7 @@ namespace CounterDrone.Core.Algorithms
bool IsDissipated { get; }
/// 当前扩散阶段:1=爆轰膨胀, 2=湍流扩散, 3=高斯扩散
int Phase { get; }
+ /// 云团已存在时间(秒)
+ float Elapsed { get; }
}
}
diff --git a/src/CounterDrone.Core/Simulation/SimulationEngine.cs b/src/CounterDrone.Core/Simulation/SimulationEngine.cs
index ea56da5..9ea4baf 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, phase = c.Dispersion.Phase }) });
+ 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, elapsed = c.Dispersion.Elapsed }) });
return list;
}
}
diff --git a/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs b/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs
index 742e4d1..87abc62 100644
--- a/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs
+++ b/test/unit/CounterDrone.Core.Tests/AlgorithmFactoryTests.cs
@@ -37,6 +37,7 @@ namespace CounterDrone.Core.Tests
public ParticleParams Particles => new();
public bool IsDissipated => false;
public int Phase => 2;
+ public float Elapsed => 10f;
public void Initialize(CounterDrone.Core.Models.AmmunitionSpec ammo,
CounterDrone.Core.Models.CombatScene env, Vector3 releasePos, float releaseTime)