修复 Unity Manager 脚本:适配 ScenarioDrone/ScenarioUnit 新 schema
This commit is contained in:
parent
d2d0ae1414
commit
e30f173312
Binary file not shown.
@ -35,9 +35,7 @@ namespace CounterDrone.Unity
|
||||
scenarioMgr.SaveScene(scenarioId, new CombatScene { WindSpeed = 0 });
|
||||
scenarioMgr.SaveScenarioDrone(scenarioId, new ScenarioDrone
|
||||
{
|
||||
WaveId = "default",
|
||||
DroneType = (int)DroneType.FixedWing, PowerType = (int)PowerType.Piston,
|
||||
Quantity = 1, TypicalSpeed = 200, TypicalAltitude = 500,
|
||||
DroneSpecId = "shahed", WaveId = "default", Quantity = 1,
|
||||
});
|
||||
scenarioMgr.SaveRoute(scenarioId, "default", new RoutePlan { FormationMode = (int)FormationMode.Single },
|
||||
new List<Waypoint>
|
||||
@ -53,10 +51,12 @@ namespace CounterDrone.Unity
|
||||
var ammoCatalog = db.Table<AmmunitionSpec>().ToList();
|
||||
|
||||
var detail = scenarioMgr.GetDetail(scenarioId);
|
||||
// 从 DB 加载 DroneSpec,构造 DroneWave
|
||||
var droneSpec = db.Table<DroneSpec>().First(d => d.Id == "shahed");
|
||||
var droneGroup = new DroneWave
|
||||
{
|
||||
WaveId = "default",
|
||||
Profile = detail.Drones[0],
|
||||
Profile = droneSpec,
|
||||
Route = detail.Routes[0],
|
||||
Waypoints = detail.WaypointGroups["default"],
|
||||
};
|
||||
@ -84,13 +84,11 @@ namespace CounterDrone.Unity
|
||||
foreach (var u in fireUnits)
|
||||
equips.Add(new ScenarioUnit
|
||||
{
|
||||
EquipmentRole = (int)EquipmentRole.LaunchPlatform,
|
||||
PlatformType = (int)u.Type, Quantity = 1,
|
||||
FireUnitSpecId = "ground-light",
|
||||
EquipmentRole = (int)EquipmentRole.LaunchPlatform, Quantity = 1,
|
||||
PositionX = u.Position.X, PositionY = u.Position.Y, PositionZ = u.Position.Z,
|
||||
AerosolType = (int)u.AmmoTypes[0],
|
||||
MunitionCount = u.TotalMunitions, Cooldown = u.Cooldown, MuzzleVelocity = u.MuzzleVelocity,
|
||||
CruiseSpeed = u.CruiseSpeed > 0 ? u.CruiseSpeed : null,
|
||||
ReleaseAltitude = u.ReleaseAltitude > 0 ? u.ReleaseAltitude : null,
|
||||
MunitionCount = u.TotalMunitions,
|
||||
});
|
||||
scenarioMgr.SaveDeployment(scenarioId, equips);
|
||||
SqliteConnectionTracker.Untrack(db);
|
||||
|
||||
@ -82,7 +82,9 @@ namespace CounterDrone.Unity
|
||||
var planner = new DefensePlanner(ammoCatalog, PlannerConfig.Load(paths));
|
||||
var threats = new List<DroneWave>
|
||||
{
|
||||
new DroneWave { WaveId = "default", Profile = detail.Drones[0], Route = detail.Routes[0], Waypoints = detail.WaypointGroups["default"] }
|
||||
new DroneWave { WaveId = "default",
|
||||
Profile = db.Table<DroneSpec>().First(d => d.Id == "shahed"),
|
||||
Route = detail.Routes[0], Waypoints = detail.WaypointGroups["default"] }
|
||||
};
|
||||
var fireUnits = new List<FireUnit>();
|
||||
for (int i = 0; i < 4; i++)
|
||||
@ -99,7 +101,7 @@ namespace CounterDrone.Unity
|
||||
scenario.SaveCloudDispersal(scenarioId, new CloudDispersal
|
||||
{
|
||||
AerosolType = (int)AerosolType.InertGas,
|
||||
DisperseHeight = detail.Drones[0].TypicalAltitude,
|
||||
DisperseHeight = db.Table<DroneSpec>().First(d => d.Id == "shahed").TypicalAltitude,
|
||||
Source = "Algorithm",
|
||||
});
|
||||
scenario.SaveDeployment(scenarioId, new List<ScenarioUnit>
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user