Class AStarPathFinder
Class that represents a path finder that implements the A* algorithm to find a path bewteen two Locations.
Inheritance
Implements
Inherited Members
Namespace: Fibula.PathFinding.AStar
Assembly: Fibula.Mechanics.PathFinding.AStar.dll
Syntax
public class AStarPathFinder : IPathFinder
Constructors
| Improve this Doc View SourceAStarPathFinder(INodeFactory, IMap, IOptions<AStarPathFinderOptions>)
Initializes a new instance of the AStarPathFinder class.
Declaration
public AStarPathFinder(INodeFactory nodeFactory, IMap map, IOptions<AStarPathFinderOptions> pathfinderOptions)
Parameters
Type | Name | Description |
---|---|---|
INodeFactory | nodeFactory | A reference to the node factory in use. |
IMap | map | A refernce to the map isntance. |
Microsoft.Extensions.Options.IOptions<AStarPathFinderOptions> | pathfinderOptions | The options for this pathfinder. |
Properties
| Improve this Doc View SourceMap
Gets the tile accessor in use.
Declaration
public IMap Map { get; }
Property Value
Type | Description |
---|---|
IMap |
NodeFactory
Gets a reference to the node factory in use.
Declaration
public INodeFactory NodeFactory { get; }
Property Value
Type | Description |
---|---|
INodeFactory |
Options
Gets the options to use for this path finder.
Declaration
public AStarPathFinderOptions Options { get; }
Property Value
Type | Description |
---|---|
AStarPathFinderOptions |
Methods
| Improve this Doc View SourceFindBetween(Location, Location, ICreature, Int32, Boolean, Int32, Location[])
Declaration
public (SearchState result, Location endLocation, IEnumerable<Direction> directions) FindBetween(Location startLocation, Location targetLocation, ICreature onBehalfOfCreature = null, int maxStepsCount = 0, bool considerAvoidsAsBlocking = true, int targetDistance = 1, params Location[] excludeLocations)
Parameters
Type | Name | Description |
---|---|---|
Location | startLocation | The start location. |
Location | targetLocation | The target location to find a path to. |
ICreature | onBehalfOfCreature | Optional. The creature on behalf of which the search is being performed. |
System.Int32 | maxStepsCount | Optional. The maximum number of search steps to perform before giving up on finding the target location. Default is DefaultMaximumSteps. |
System.Boolean | considerAvoidsAsBlocking | Optional. A value indicating whether to consider the creature avoid tastes as blocking in path finding. Defaults to true. |
System.Int32 | targetDistance | Optional. The target distance from the target node to shoot for. |
Location[] | excludeLocations | Optional. Locations to explicitly exclude as a valid goal in the search. |
Returns
Type | Description |
---|---|
System.ValueTuple<SearchState, Location, System.Collections.Generic.IEnumerable<Direction>> | A tuple consisting of the result of the path search, the end location before returning (even when giving up), and an System.Collections.Generic.IEnumerable<T> of Directions leading to that end location. |