| | | 1 | | using FixedMathSharp; |
| | | 2 | | using System; |
| | | 3 | | |
| | | 4 | | namespace Trailblazer.Pathing; |
| | | 5 | | |
| | | 6 | | internal sealed class HybridRouteStep |
| | | 7 | | { |
| | | 8 | | public HybridRouteStepKind Kind { get; private set; } |
| | | 9 | | |
| | | 10 | | public IPathRequest SegmentRequest { get; private set; } = null!; |
| | | 11 | | |
| | | 12 | | public TrailblazerWorldContext Context { get; private set; } = null!; |
| | | 13 | | |
| | | 14 | | public Vector3d WaypointPosition { get; private set; } |
| | | 15 | | |
| | | 16 | | public int AdditionalCost { get; private set; } |
| | | 17 | | |
| | | 18 | | public string[] SegmentChartKeys { get; private set; } = Array.Empty<string>(); |
| | | 19 | | |
| | 1536 | 20 | | private HybridRouteStep() { } |
| | | 21 | | |
| | | 22 | | public static HybridRouteStep Segment( |
| | | 23 | | IPathRequest request, |
| | | 24 | | int additionalCost = 0, |
| | 208 | 25 | | string[]? chartKeys = null) => new() |
| | 208 | 26 | | { |
| | 208 | 27 | | Kind = HybridRouteStepKind.PathSegment, |
| | 208 | 28 | | SegmentRequest = request, |
| | 208 | 29 | | Context = request.Context, |
| | 208 | 30 | | AdditionalCost = additionalCost, |
| | 208 | 31 | | SegmentChartKeys = chartKeys ?? Array.Empty<string>() |
| | 208 | 32 | | }; |
| | | 33 | | |
| | | 34 | | public static HybridRouteStep Waypoint( |
| | | 35 | | TrailblazerWorldContext context, |
| | | 36 | | Vector3d position, |
| | | 37 | | int additionalCost = 0) |
| | | 38 | | { |
| | 560 | 39 | | PathRequestContextResolver.ThrowIfUnusable(context); |
| | 560 | 40 | | return new() |
| | 560 | 41 | | { |
| | 560 | 42 | | Kind = HybridRouteStepKind.Waypoint, |
| | 560 | 43 | | Context = context, |
| | 560 | 44 | | WaypointPosition = position, |
| | 560 | 45 | | AdditionalCost = additionalCost |
| | 560 | 46 | | }; |
| | | 47 | | } |
| | | 48 | | } |