CounterDroneBackend/docs/design/technical/仿真器实体与事件映射.md
tian 56d345189e refactor: 编组概念拆分为批次(WaveId)+火力单元(FireUnit)
Breaking: Group表/枚举/Service/Repository移除; GroupId->WaveId; DroneGroup->DroneWave; DroneGroupId->DroneWaveId; GroupManager删除

Docs: CHANGELOG 0.7.0; 总体架构 V10; DefensePlanner V4; 实施计划 V1.4; 对接文档 V1.2

Tests: 204/204 pass
2026-06-15 15:13:48 +08:00

80 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 仿真器实体与事件映射
## 实体总览
| 实体 | 类 | 生命周期 | 主要属性 |
|------|------|------|------|
| 无人机 | `DroneEntity` | 仿真全程 | Pos, Hp, Status, Route, ExposureTime |
| 发射平台 | `PlatformEntity` | 仿真全程 | Pos, PlatformType, StateIdle/FlyingToTarget/ReadyToRelease, AerosolType, MunitionCount, Cooldown, CruiseSpeed, MuzzleVelocity, CurrentVelocity |
| 飞行弹药 | `MunitionEntity` | 发射→到达释放高度 | Pos, LaunchModeAirDrop/GroundArtillery, Target, HasArrived, 空基载机速度矢量 |
| 气溶胶云团 | `CloudEntity` | 弹药到达→消散 | Center, Radius, CoreDensity, IsDissipated |
| 管控区域 | `ControlZoneEntity` | 仿真全程 | Vertices, Min/MaxAltitude |
## 事件一览
| 事件 | 触发条件 | 参数 | Unity 典型响应 |
|------|------|------|------|
| `OnMunitionLaunched` | 发射计划时间到达 + 平台就绪 | `MunitionEntity` | 生成炮弹模型,播放发射动画 |
| `OnCloudGenerated` | 弹药到达释放高度 | `CloudEntity` | 生成粒子系统,初始半径+颜色 |
| `OnDroneDestroyed` | 毁伤判定 HP ≤ 0 | `DroneEntity` | 播放爆炸/坠毁动画 |
| `OnDroneReachedTarget` | 到达最后航路点 | `DroneEntity` | 显示"目标抵达"提示 |
| `OnZoneIntruded` | 无人机进入管控区 | `DroneEntity`, `ControlZoneEntity` | 红色警报 |
| `OnSimulationEnded` | 所有无人机状态 ≠ Flying | 无 | 显示结果面板,触发报告生成 |
## 实体 × 事件 矩阵
| | MunitionLaunched | CloudGenerated | DroneDestroyed | ReachedTarget | ZoneIntruded | SimEnded |
|------|:---:|:---:|:---:|:---:|:---:|:---:|
| DroneEntity | | | ✅ | ✅ | ✅ | |
| PlatformEntity | ✅ | | | | | |
| MunitionEntity | ✅ | | | | | |
| CloudEntity | | ✅ | | | | |
| ControlZoneEntity | | | | | ✅ | |
| 全局 | | | | | | ✅ |
## 数据流
```
想定配置EquipmentDeployment + TargetConfig + RoutePlan + CombatScene
SimulationEngine.Initialize()
├─ BuildFireUnits() → List<FireUnit>
├─ BuildDroneWaves() → List<DroneWave>
IDefensePlanner.Plan(fireUnits, threats, scene)
├─ 五步流水线 → FireSchedule发射计划
SimulationEngine.Tick()
├─ 【地基】时间到达 → PlatformEntity.Release() → MunitionEntity 创建
│ └─ OnMunitionLaunched ──→ Unity: 炮弹 3D 模型
├─ 【空基】时间到达 → PlatformEntity.CommandFlyTo() → 飞行中 → CanRelease
│ └─ Release() → MunitionEntity(AirDrop, 载机速度) → OnMunitionLaunched
│ └─ OnMunitionLaunched ──→ Unity: 空基投放
├─ MunitionEntity 飞行 → 到达释放高度
│ ├─ 地基抛物线弹道Kinematics.ParabolicPosition
│ └─ 空基:载机速度 + 重力Kinematics.AirDropPosition
│ │
│ ├─ CloudEntity 创建
│ ├─ OnCloudGenerated ──→ Unity: 粒子系统
│ └─ 扩散 → 毁伤判定
│ ├─ DroneEntity.Hp -= dmg
│ └─ HP≤0 → OnDroneDestroyed ──→ Unity: 爆炸动画
├─ DroneEntity.Update() → 到达终点
│ └─ OnDroneReachedTarget ──→ Unity: 抵达提示
├─ ControlZone.ContainsPoint()
│ └─ OnZoneIntruded ──→ Unity: 红色警报
└─ All drones done
└─ OnSimulationEnded ──→ Unity: 结果面板 + 报告生成
```