AircraftZC.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using KYFramework;
  2. using Model;
  3. using MongoDB.Bson;
  4. using QuYuSaoMiao;
  5. using SimulationServer.Utils;
  6. namespace SimulationServer;
  7. public class AircraftZC : Entity
  8. {
  9. public FlightPlanEditor? FlightPlanEditor; // 飞行计划编辑器
  10. public TurningPoint[] turningPoints = new TurningPoint[200];
  11. public AircraftDB Db;
  12. public List<double[]> SC01;
  13. public ZCTask content;
  14. public double TotalFuelConsumption;
  15. public void Awake()
  16. {
  17. for (int i = 0; i < turningPoints.Length; i++)
  18. {
  19. turningPoints[i] = new TurningPoint();
  20. }
  21. turningPoints = FXJHGenerate.FromStartToMission(FlightPlanEditor,turningPoints);//生成从起点到任务段起点的航路点
  22. SC01 = GeDianShengCheng.scanroute(content.poly,content.ScanRange,content.hSC,content.isRealHeight,content.isSurround,content.SurroundNum,GeDianShengCheng.DemHelper());//侦查模型输出的航路点位置
  23. turningPoints = FXJHGenerate.ZhenCha(SC01, FlightPlanEditor, turningPoints);
  24. turningPoints = FXJHGenerate.FromMissionToEnd(FlightPlanEditor, FXJHGenerate.ZhenChaMissionEndPoint(SC01), turningPoints, SC01.Count + 1);
  25. turningPoints = FXJHGenerate.FXJHTPDiedai(FlightPlanEditor, turningPoints, SC01.Count + 3);
  26. }
  27. public void End()
  28. {
  29. TotalFuelConsumption = turningPoints[0].RemainingFuel - turningPoints[SC01.Count + 2].RemainingFuel;
  30. }
  31. }
  32. [ObjectSystem]
  33. public class AircraftZCAwakeSystem : AwakeSystem<AircraftZC,FlightPlanEditor,ZCTask>
  34. {
  35. public override void Awake(AircraftZC self,FlightPlanEditor flightPlanEditor,ZCTask zcTask)
  36. {
  37. self.content = zcTask;
  38. self.FlightPlanEditor = flightPlanEditor;
  39. // 读取数据库
  40. self.Db = Util.GetAircraftDefine(self.FlightPlanEditor.aircraftparameter.AircraftType,self.FlightPlanEditor.aircraftparameter.AircraftSubType,self.FlightPlanEditor.aircraftparameter.AircraftID);
  41. self.Awake();
  42. }
  43. }