补充GroupManager + 架构文档V8(事件驱动/FireSchedule/三阶段扩散)
This commit is contained in:
parent
19dec8e30b
commit
b77c308517
@ -1,11 +1,11 @@
|
||||
# 反无人机仿真系统 — 总体架构设计
|
||||
|
||||
> **版本**:V7
|
||||
> **日期**:2026-06-11
|
||||
> **状态**:设计中
|
||||
> **版本**:V8
|
||||
> **日期**:2026-06-12
|
||||
> **状态**:已实现
|
||||
> **Unity 版本**:22.3.62
|
||||
> **.NET 版本**:.NET Standard 2.1
|
||||
> **变更**:明确 Core 程序集独立于 Unity;新增 IPathProvider 隔离点;新增测试策略(xUnit/确定性测试/CI 兼容)
|
||||
> **变更**:事件驱动替代 EventQueue;FireSchedule 统一发射接口;三阶段扩散模型;默认弹药 JSON 配置;Phase/Elapsed 属性
|
||||
|
||||
---
|
||||
|
||||
@ -49,15 +49,15 @@
|
||||
│ │ GroupService │ │ DefenseAdvisor│ │ ├ DroneEntity │ │
|
||||
│ └──────────────┘ └──────────────┘ │ ├ PlatformEntity │ │
|
||||
│ ┌──────────────┐ ┌──────────────┐ │ ├ MunitionEntity │ │
|
||||
│ │ RecordService│ │ReportService │ │ ├ CloudEntity │ │
|
||||
│ │FrameDataStore│ │ReportService │ │ ├ CloudEntity │ │
|
||||
│ │ │ │ ├ ReportGen │ │ │ └ GaussianPuff│ │
|
||||
│ └──────────────┘ │ └ PDF/Word │ │ ├ ControlZone │ │
|
||||
│ └──────────────┘ │ └ Markdown │ │ ├ ControlZone │ │
|
||||
│ └──────────────┘ │ ├ IDamageModel×3 │ │
|
||||
│ │ └ EventQueue │ │
|
||||
│ │ └ FireSchedule │ │
|
||||
│ ┌──────────────────────────────────────────────────────┐│
|
||||
│ │ Algorithm Layer (自主实现) ││
|
||||
│ │ DispersionEngine | DamageCalculator ││
|
||||
│ │ DefenseAdvisor | SpatioTemporalOptimizer ││
|
||||
│ │ GaussianPuffDispersion | DamageCalculator ││
|
||||
│ │ DefaultDefenseAdvisor | Kinematics(PG稳定度) ││
|
||||
│ └──────────────────────────────────────────────────────┘│
|
||||
├──────────────────────────────────────────────────────────┤
|
||||
│ Data Layer │
|
||||
|
||||
41
src/Unity/Assets/Scripts/Managers/GroupManager.cs
Normal file
41
src/Unity/Assets/Scripts/Managers/GroupManager.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using CounterDrone.Core;
|
||||
using CounterDrone.Core.Models;
|
||||
using CounterDrone.Core.Repository;
|
||||
using CounterDrone.Core.Services;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CounterDrone.Unity
|
||||
{
|
||||
/// <summary>编组管理桥接 — 无人机编队和装备编组的 CRUD</summary>
|
||||
public class GroupManager : MonoBehaviour
|
||||
{
|
||||
private IGroupService _service;
|
||||
|
||||
public IGroupService Service => _service;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
var paths = new UnityPathProvider();
|
||||
var db = new DatabaseManager(paths).OpenMainDb();
|
||||
_service = new GroupService(new GroupRepository(db));
|
||||
}
|
||||
|
||||
public Group Create(string name, GroupType type, string desc = "")
|
||||
=> _service.CreateGroup(name, type, desc);
|
||||
|
||||
public void Delete(string id) => _service.DeleteGroup(id);
|
||||
|
||||
public List<Group> GetByType(GroupType? type = null) => _service.GetGroups(type);
|
||||
|
||||
public Group Get(string id) => _service.GetGroup(id);
|
||||
|
||||
[ContextMenu("Verify")]
|
||||
void Verify()
|
||||
{
|
||||
Awake();
|
||||
var g = Create("测试编队", GroupType.DroneFleet, "自动验证");
|
||||
Debug.Log($"GroupManager OK. Created: {g.Name} ({g.Id})");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user