Class AStarOption
Burst compatible methods to find the first option for which a path exists.
Namespace: AnyPath.Native
Assembly: AnyPath.dll
Syntax
public static class AStarOption
Remarks
All of the methods contained in the AnyPath.Native namespace are compatible with Unity's Burst compiler
Methods
EvalOptionRemap<TGraph, TNode, TH, TMod>(ref AStar<TNode>, ref TGraph, NativeSlice<int>, NativeSlice<TNode>, NativeSlice<OffsetInfo>, TH, TMod)
Similar to FindOptionRemap but only returns the first option for which a path exists.
Declaration
public static AStarEvalOptionResult EvalOptionRemap<TGraph, TNode, TH, TMod>(this ref AStar<TNode> aStar, ref TGraph graph, NativeSlice<int> remap, NativeSlice<TNode> nodes, NativeSlice<OffsetInfo> offsets, TH heuristicProvider, TMod edgeMod) where TGraph : struct, IGraph<TNode> where TNode : unmanaged, IEquatable<TNode> where TH : struct, IHeuristicProvider<TNode> where TMod : struct, IEdgeMod<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| AStar<TNode> | aStar | |
| TGraph | graph | |
| NativeSlice<int> | remap | |
| NativeSlice<TNode> | nodes | |
| NativeSlice<OffsetInfo> | offsets | |
| TH | heuristicProvider | |
| TMod | edgeMod |
Returns
| Type | Description |
|---|---|
| AStarEvalOptionResult |
Type Parameters
| Name | Description |
|---|---|
| TGraph | |
| TNode | |
| TH | |
| TMod |
Evaloption<TGraph, TNode, TH, TMod>(ref AStar<TNode>, ref TGraph, NativeSlice<TNode>, NativeSlice<OffsetInfo>, TH, TMod)
Similar to FindOption but only evaluates the first index of the option for which a path exists.
Declaration
public static AStarEvalOptionResult Evaloption<TGraph, TNode, TH, TMod>(this ref AStar<TNode> aStar, ref TGraph graph, NativeSlice<TNode> nodes, NativeSlice<OffsetInfo> offsets, TH heuristicProvider, TMod edgeMod) where TGraph : struct, IGraph<TNode> where TNode : unmanaged, IEquatable<TNode> where TH : struct, IHeuristicProvider<TNode> where TMod : struct, IEdgeMod<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| AStar<TNode> | aStar | |
| TGraph | graph | |
| NativeSlice<TNode> | nodes | |
| NativeSlice<OffsetInfo> | offsets | |
| TH | heuristicProvider | |
| TMod | edgeMod |
Returns
| Type | Description |
|---|---|
| AStarEvalOptionResult |
Type Parameters
| Name | Description |
|---|---|
| TGraph | |
| TNode | |
| TH | |
| TMod |
FindOptionRemap<TGraph, TNode, TH, TMod, TProc, TSeg>(ref AStar<TNode>, ref TGraph, NativeSlice<int>, NativeSlice<TNode>, NativeSlice<OffsetInfo>, TH, TMod, TProc, NativeList<TSeg>)
Finds the path of the first option that is encountered that has a valid path. But uses the indicices in the remap array to determine the order of evaluation.
Declaration
public static AStarFindOptionResult FindOptionRemap<TGraph, TNode, TH, TMod, TProc, TSeg>(this ref AStar<TNode> aStar, ref TGraph graph, NativeSlice<int> remap, NativeSlice<TNode> nodes, NativeSlice<OffsetInfo> offsets, TH heuristicProvider, TMod edgeMod, TProc pathProcessor, NativeList<TSeg> pathBuffer) where TGraph : struct, IGraph<TNode> where TNode : unmanaged, IEquatable<TNode> where TH : struct, IHeuristicProvider<TNode> where TMod : struct, IEdgeMod<TNode> where TProc : struct, IPathProcessor<TNode, TSeg> where TSeg : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| AStar<TNode> | aStar | Working memory for the algorithm to use |
| TGraph | graph | The graph to perform the request on |
| NativeSlice<int> | remap | Array containing the order of evaluation for the options. If for example you want to evaluate the options in reverse order, a remap array for 2 options would look like: remap[0] = 1, remap[1] = 0 |
| NativeSlice<TNode> | nodes | A flattened representation of all the stops to visit in order, per option |
| NativeSlice<OffsetInfo> | offsets | Describes the mapping of stops from the nodes array per option using a starting index and length. For example, if you have two options that both only have a start and goal stop, this would look as follows: offets[0] = { start: 0, length: 2 } offsets[1] = { start: 2 : length 2 } |
| TH | heuristicProvider | |
| TMod | edgeMod | |
| TProc | pathProcessor | Path processor to use |
| NativeList<TSeg> | pathBuffer | The segment buffer to append the path to. This buffer is not cleared. |
Returns
| Type | Description |
|---|---|
| AStarFindOptionResult | A AStarFindOptionResult struct indicating if a path was found and the offsets in the path buffer. Note that the index that is returned is the original index of the option in the offsets array. |
Type Parameters
| Name | Description |
|---|---|
| TGraph | The type of graph to find a path on |
| TNode | Type of nodes |
| TH | |
| TMod | |
| TProc | Type of the path processor |
| TSeg | Type of segments make up the path |
Remarks
This method is used by the Priority Finder.
FindOption<TGraph, TNode, TH, TMod, TProc, TSeg>(ref AStar<TNode>, ref TGraph, NativeSlice<TNode>, NativeSlice<OffsetInfo>, TH, TMod, TProc, NativeList<TSeg>)
Finds the path of the first option that is encountered that has a valid path.
Declaration
public static AStarFindOptionResult FindOption<TGraph, TNode, TH, TMod, TProc, TSeg>(this ref AStar<TNode> aStar, ref TGraph graph, NativeSlice<TNode> nodes, NativeSlice<OffsetInfo> offsets, TH heuristicProvider, TMod edgeMod, TProc pathProcessor, NativeList<TSeg> pathBuffer) where TGraph : struct, IGraph<TNode> where TNode : unmanaged, IEquatable<TNode> where TH : struct, IHeuristicProvider<TNode> where TMod : struct, IEdgeMod<TNode> where TProc : struct, IPathProcessor<TNode, TSeg> where TSeg : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| AStar<TNode> | aStar | The memory container for the algorithm to use |
| TGraph | graph | The graph to perform the request on |
| NativeSlice<TNode> | nodes | A flattened representation of all the stops to visit in order, per option |
| NativeSlice<OffsetInfo> | offsets | Describes the mapping of stops from the nodes array per option using a starting index and length. For example, if you have two options that both only have a start and goal stop, this would look as follows: offets[0] = { start: 0, length: 2 } offsets[1] = { start: 2 : length 2 } |
| TH | heuristicProvider | |
| TMod | edgeMod | |
| TProc | pathProcessor | Path processor to use |
| NativeList<TSeg> | pathBuffer | The edge buffer to append the path to |
Returns
| Type | Description |
|---|---|
| AStarFindOptionResult | A AStarFindOptionResult struct indicating if a path was found and the offsets in the path buffer |
Type Parameters
| Name | Description |
|---|---|
| TGraph | The type of graph to find a path on |
| TNode | Type of nodes |
| TH | |
| TMod | |
| TProc | Type of the path processor |
| TSeg | Type of segments make up the path |