Class WalkAction.AStarWalk
The implementation of the A* algorithm for the WalkAction, based on MLEM's generic MLEM.Pathfinding.AStar<T> implementation.
public class WalkAction.AStarWalk : AStar<(Point Pos, int Floor)>
- Inheritance
-
WalkAction.AStarWalk
- Inherited Members
-
AStar<(Point Pos, int Floor)>.DefaultCostFunctionAStar<(Point Pos, int Floor)>.DefaultCostAStar<(Point Pos, int Floor)>.DefaultMaxTriesAStar<(Point Pos, int Floor)>.DefaultAdditionalNeighborsAStar<(Point Pos, int Floor)>.GetHeuristicDistance((Point Pos, int Floor), (Point Pos, int Floor))AStar<(Point Pos, int Floor)>.CollectNeighbors((Point Pos, int Floor), ISet<(Point Pos, int Floor)>)AStar<(Point Pos, int Floor)>.LastTriesNeededAStar<(Point Pos, int Floor)>.LastTimeNeeded
- Extension Methods
Constructors
AStarWalk(Action)
Creates a new A* pathfinder for the given action.
public AStarWalk(Action action)
Parameters
Methods
CollectNeighbors((Point Pos, int Floor), ISet<(Point Pos, int Floor)>)
This method should populate a set of positions that are considered neighbors
to the given position
. For example, this method might return directly adjacent positions, diagonal positions, or faraway positions that can be teleported to.
protected override void CollectNeighbors((Point Pos, int Floor) position, ISet<(Point Pos, int Floor)> neighbors)
Parameters
position
(Point Pos, int Floor)The position whose neighbors to return.
neighbors
ISet<(Point Pos, int Floor)>The set to populate with neighbors.
GetHeuristicDistance((Point Pos, int Floor), (Point Pos, int Floor))
This method should implement a heuristic that determines the total distance between the given start
position and the given second position position
.
Note that this is multiplied with the MLEM.Pathfinding.AStar<T>.DefaultCost automatically, so no costs need to be considered in this method's return value.
protected override float GetHeuristicDistance((Point Pos, int Floor) start, (Point Pos, int Floor) position)
Parameters
start
(Point Pos, int Floor)The start position.
position
(Point Pos, int Floor)The position to get the distance to.
Returns
- float
The total distance between the two positions.