| | | 1 | | //======================================================================= |
| | | 2 | | // NavigationGraphEdge.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using GridForge.Grids.Topology; |
| | | 9 | | |
| | | 10 | | namespace Trailblazer.Pathing; |
| | | 11 | | |
| | | 12 | | /// <summary>Identifies the structural kind of one graph edge.</summary> |
| | | 13 | | internal enum NavigationGraphEdgeKind : byte |
| | | 14 | | { |
| | | 15 | | Native = 0, |
| | | 16 | | Explicit = 1, |
| | | 17 | | Seam = 2 |
| | | 18 | | } |
| | | 19 | | |
| | | 20 | | /// <summary>Describes one allocation-free graph edge result.</summary> |
| | | 21 | | internal readonly struct NavigationGraphEdge |
| | | 22 | | { |
| | | 23 | | internal NavigationGraphEdge( |
| | | 24 | | NavigationNodeRef target, |
| | | 25 | | NavigationGraphEdgeKind kind, |
| | | 26 | | GridNavigationPortal nativePortal, |
| | | 27 | | int nativeDirectionOrdinal = -1) |
| | | 28 | | { |
| | 788939 | 29 | | Target = target; |
| | 788939 | 30 | | Kind = kind; |
| | 788939 | 31 | | NativePortal = nativePortal; |
| | 788939 | 32 | | NativeDirectionOrdinal = nativeDirectionOrdinal; |
| | 788939 | 33 | | ExplicitConnection = null!; |
| | 788939 | 34 | | AutomaticSeam = default; |
| | 788939 | 35 | | } |
| | | 36 | | |
| | | 37 | | internal NavigationGraphEdge( |
| | | 38 | | NavigationNodeRef target, |
| | | 39 | | NavigationExplicitConnectionRecord explicitConnection) |
| | | 40 | | { |
| | 167086 | 41 | | Target = target; |
| | 167086 | 42 | | Kind = NavigationGraphEdgeKind.Explicit; |
| | 167086 | 43 | | NativePortal = default; |
| | 167086 | 44 | | NativeDirectionOrdinal = -1; |
| | 167086 | 45 | | ExplicitConnection = explicitConnection; |
| | 167086 | 46 | | AutomaticSeam = default; |
| | 167086 | 47 | | } |
| | | 48 | | |
| | | 49 | | internal NavigationGraphEdge( |
| | | 50 | | NavigationNodeRef target, |
| | | 51 | | NavigationAutomaticSeamRef automaticSeam) |
| | | 52 | | { |
| | 202969 | 53 | | Target = target; |
| | 202969 | 54 | | Kind = NavigationGraphEdgeKind.Seam; |
| | 202969 | 55 | | NativePortal = default; |
| | 202969 | 56 | | NativeDirectionOrdinal = -1; |
| | 202969 | 57 | | ExplicitConnection = null!; |
| | 202969 | 58 | | AutomaticSeam = automaticSeam; |
| | 202969 | 59 | | } |
| | | 60 | | |
| | | 61 | | internal NavigationNodeRef Target { get; } |
| | | 62 | | |
| | | 63 | | internal NavigationGraphEdgeKind Kind { get; } |
| | | 64 | | |
| | | 65 | | internal GridNavigationPortal NativePortal { get; } |
| | | 66 | | |
| | | 67 | | internal int NativeDirectionOrdinal { get; } |
| | | 68 | | |
| | | 69 | | internal NavigationExplicitConnectionRecord ExplicitConnection { get; } |
| | | 70 | | |
| | | 71 | | internal NavigationAutomaticSeamRef AutomaticSeam { get; } |
| | | 72 | | } |