ezEngine  Milestone 7
ezPathStateGenerator< PathStateType > Class Template Referenceabstract

The base class for all path state generates. More...

#include <PathState.h>

Public Member Functions

virtual void GenerateAdjacentStates (ezInt64 iNodeIndex, const PathStateType &StartState, ezPathSearch< PathStateType > *pPathSearch)=0
 Called by a ezPathSearch object to generate the adjacent states from graph node iNodeIndex. More...
 
virtual void StartSearchForClosest (ezInt64 iStartNodeIndex, const PathStateType *pStartState)
 Automatically called by ezPathSearch objects when a new path search is about to start (ezPathSearch::FindClosest). Allows the generator to do some initial setup.
 
virtual void StartSearch (ezInt64 iStartNodeIndex, const PathStateType *pStartState, ezInt64 iTargetNodeIndex)
 Automatically called by ezPathSearch objects when a new path search is about to start (ezPathSearch::FindPath). Allows the generator to do some initial setup.
 
virtual void SearchFinished (ezResult res)
 Automatically called by ezPathSearch objects when a path search was finished. Allows the generator to do some cleanup.
 

Detailed Description

template<typename PathStateType>
class ezPathStateGenerator< PathStateType >

The base class for all path state generates.

A path state generator is a class that takes one 'path state' (typically a node in a graph) and generates all the adjacent nodes that can be reached from there. It carries state, which allows to expand nodes only in certain directions, depending on what actions are possible at some graph node.

This can be used to do path searches where the capabilities of a unit are taken into account, such as limited turning speeds. The 'state' that is then carried is the current orientation of the unit at that point along the path, which determines into which directions the path search can be expanded.

PathStateType needs to be derived from ezPathStateBase.

Member Function Documentation

template<typename PathStateType>
virtual void ezPathStateGenerator< PathStateType >::GenerateAdjacentStates ( ezInt64  iNodeIndex,
const PathStateType &  StartState,
ezPathSearch< PathStateType > *  pPathSearch 
)
pure virtual

Called by a ezPathSearch object to generate the adjacent states from graph node iNodeIndex.

On a 2D grid the iNodeIndex would just be the grid cell index (GridHeight * Cell.y + Cell.x). This function would then 'expand' the 4 or 8 direct neighbor cells by creating a new PathStateType object for each and then passing that to the ezPathSearch object pPathSearch by calling ezPathSearch::AddPathNode.


The documentation for this class was generated from the following file: