SmartEngine  1.6.0
Classes | Public Member Functions | Properties | List of all members
SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType > Class Template Referenceabstract

Generic version of the A* algorithm that allows you to specify your own custom graph structure along with actions to be taken. More...

Public Member Functions

int GetPathDepth ()
 Returns the depth (g-score) of the best destination. This is equal to the path length if the cost to move is always 1 More...
 
AStarPath< DataType, ActionType > GetBestPath ()
 Get the path associated with the best destination cell. You must call FindPathToGoal() before this is valid. More...
 
void FindPathToGoal (PathingParametersType args)
 Synchronously search for the best path to take. Call GetBestPath() to return the path after this completes More...
 
IEnumerator FindPathToGoalAsync (PathingParametersType args)
 Asynchronously search for the best path to take. Call GetBestPath() to return the path after this completes More...
 
virtual void Reset ()
 Resets the state for a new search. Automatically called at the start of a search. More...
 

Properties

int MaxSearchDepth [get, set]
 How far to search before giving up. A value of 0 (default) means search until we've found a solution or exhausted all nodes. This value is compared against the g-score, so neighbors that have higher movement cost will have higher impact on the search depth More...
 
int MaxPathLength [get, set]
 The maximum length path to return. This does not affect how deep we explore before finding a path. It simply truncates the path returned. A value of 0 (default) means don't truncate. More...
 
float GScoreMultiplier [get, set]
 Global multiplier on the g-score. Defaults to 1.0. Setting this to a value lower than one means we value the path we've taken so far less than how long we think it'll take to reach the goal. More...
 
bool? BestPathReachedGoal [get]
 Returns true if we've reached the goal More...
 

Detailed Description

Generic version of the A* algorithm that allows you to specify your own custom graph structure along with actions to be taken.

Template Parameters
DataType
ActionType
PathingParametersType

Member Function Documentation

◆ FindPathToGoal()

void SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.FindPathToGoal ( PathingParametersType  args)

Synchronously search for the best path to take. Call GetBestPath() to return the path after this completes

Parameters
args

◆ FindPathToGoalAsync()

IEnumerator SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.FindPathToGoalAsync ( PathingParametersType  args)

Asynchronously search for the best path to take. Call GetBestPath() to return the path after this completes

Parameters
args
Returns

◆ GetBestPath()

AStarPath<DataType, ActionType> SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.GetBestPath ( )

Get the path associated with the best destination cell. You must call FindPathToGoal() before this is valid.

Returns

◆ GetPathDepth()

int SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.GetPathDepth ( )

Returns the depth (g-score) of the best destination. This is equal to the path length if the cost to move is always 1

Returns

◆ Reset()

virtual void SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.Reset ( )
virtual

Resets the state for a new search. Automatically called at the start of a search.

Property Documentation

◆ BestPathReachedGoal

bool? SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.BestPathReachedGoal
get

Returns true if we've reached the goal

◆ GScoreMultiplier

float SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.GScoreMultiplier
getset

Global multiplier on the g-score. Defaults to 1.0. Setting this to a value lower than one means we value the path we've taken so far less than how long we think it'll take to reach the goal.

◆ MaxPathLength

int SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.MaxPathLength
getset

The maximum length path to return. This does not affect how deep we explore before finding a path. It simply truncates the path returned. A value of 0 (default) means don't truncate.

◆ MaxSearchDepth

int SmartEngine.Pathing.AStar< DataType, ActionType, PathingParametersType >.MaxSearchDepth
getset

How far to search before giving up. A value of 0 (default) means search until we've found a solution or exhausted all nodes. This value is compared against the g-score, so neighbors that have higher movement cost will have higher impact on the search depth