Table of Contents

Class WalkAction.AStarWalk

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

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
AStar<(Point Pos, int Floor)>
WalkAction.AStarWalk
Inherited Members
AStar<(Point Pos, int Floor)>.DefaultCostFunction
AStar<(Point Pos, int Floor)>.DefaultCost
AStar<(Point Pos, int Floor)>.DefaultMaxTries
AStar<(Point Pos, int Floor)>.DefaultAdditionalNeighbors
AStar<(Point Pos, int Floor)>.GetHeuristicDistance((Point Pos, int Floor), (Point Pos, int Floor))
AStar<(Point Pos, int Floor)>.LastTriesNeeded
AStar<(Point Pos, int Floor)>.LastTimeNeeded
Extension Methods

Constructors

AStarWalk(Action)

Creates a new A* pathfinder for the given action.

public AStarWalk(Action action)

Parameters

action Action

The underlying action, which determines the Person who will be walking.

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.