| | | 1 | | using System.Collections.Generic; |
| | | 2 | | using System.Linq; |
| | | 3 | | |
| | | 4 | | // Flight plan. |
| | | 5 | | // |
| | | 6 | | // The flight plan contains a sorted list of waypoints for the agent on the way to the asset. |
| | | 7 | | public class FlightPlan { |
| | | 8 | | // List of waypoints sorted by distance in descending order. |
| | | 9 | | private List<Configs.FlightPlanWaypoint> _waypoints; |
| | | 10 | | |
| | 1910 | 11 | | public Configs.FlightPlan Config { get; init; } |
| | | 12 | | |
| | | 13 | | public IReadOnlyList<Configs.FlightPlanWaypoint> Waypoints { |
| | 36319 | 14 | | get { |
| | 37274 | 15 | | if (_waypoints == null) { |
| | | 16 | | // Sort the waypoints by distance in descending order to allow attack behaviors to iterate |
| | | 17 | | // from the farthest waypoint to the closest one. |
| | 3862 | 18 | | _waypoints = Config.Waypoints.OrderByDescending(waypoint => waypoint.Distance).ToList(); |
| | 955 | 19 | | } |
| | 36319 | 20 | | return _waypoints.AsReadOnly(); |
| | 36319 | 21 | | } |
| | | 22 | | } |
| | | 23 | | |
| | 1910 | 24 | | public FlightPlan(Configs.FlightPlan config) { |
| | 955 | 25 | | Config = config ?? new Configs.FlightPlan(); |
| | 955 | 26 | | } |
| | | 27 | | } |