Loading...
Searching...
No Matches
CityBuilderCore.GridPathfinding Class Reference

Detailed Description

simple a* implementation for non diagonal pathfinding between equidistant points, used by road and mapGrid pathfinding

Inheritance diagram for CityBuilderCore.GridPathfinding:
CityBuilderCore.GridPathfindingBase CityBuilderCore.IRoadPathfinder CityBuilderCore.IRoadPathfinderBlocked CityBuilderCore.IMapGridPathfinder CityBuilderCore.IPathfinder CityBuilderCore.IPathfinder CityBuilderCore.IPathfinder

Public Member Functions

override void Calculate (int maxCalculations=PathQuery.DEFAULT_MAX_CALCULATIONS)
 
override void Add (Vector2Int point)
 
override void Remove (Vector2Int point)
 
override void Clear ()
 
override void AddLink (IGridLink link)
 
override void RemoveLink (IGridLink link)
 
override void AddSwitch (Vector2Int point, GridPathfindingBase other)
 
override void AddSwitch (Vector2Int entry, Vector2Int point, Vector2Int exit, GridPathfindingBase other)
 
override void BlockTags (IEnumerable< Vector2Int > points, IEnumerable< object > tags)
 
override void UnblockTags (IEnumerable< Vector2Int > points, IEnumerable< object > tags)
 
override IEnumerable< Vector2Int > GetPoints ()
 
override bool HasPoint (Vector2Int point, object tag=null)
 checks if a point exists within the pathfinder
for example points on map pathing that are blocked or points for road pathing that dont have a road
 
override WalkingPath FindPath (Vector2Int[] starts, Vector2Int[] targets, object tag=null)
 attempts to find a path between one of the starts and one of the ends
 
override PathQuery FindPathQuery (Vector2Int[] starts, Vector2Int[] targets, object tag=null)
 
override void Dispose ()
 
- Public Member Functions inherited from CityBuilderCore.GridPathfindingBase
void Calculate (int maxCalculations=PathQuery.DEFAULT_MAX_CALCULATIONS)
 
virtual void Add (IEnumerable< Vector2Int > points)
 
void Add (Vector2Int point)
 
virtual void Remove (IEnumerable< Vector2Int > points)
 
void Remove (Vector2Int point)
 
void Clear ()
 
void AddLink (IGridLink link)
 
void RemoveLink (IGridLink link)
 
void AddSwitch (Vector2Int point, GridPathfindingBase pathfinding)
 
void AddSwitch (Vector2Int entry, Vector2Int point, Vector2Int exit, GridPathfindingBase pathfinding)
 
void BlockTags (IEnumerable< Vector2Int > points, IEnumerable< object > tags)
 
void UnblockTags (IEnumerable< Vector2Int > points, IEnumerable< object > tags)
 
IEnumerable< Vector2Int > GetPoints ()
 
bool HasPoint (Vector2Int point, object tag=null)
 checks if a point exists within the pathfinder
for example points on map pathing that are blocked or points for road pathing that dont have a road
 
WalkingPath FindPath (Vector2Int[] starts, Vector2Int[] targets, object tag=null)
 attempts to find a path between one of the starts and one of the ends
 
PathQuery FindPathQuery (Vector2Int[] starts, Vector2Int[] targets, object tag=null)
 
void Dispose ()
 

Additional Inherited Members

- Static Public Attributes inherited from CityBuilderCore.GridPathfindingBase
const int COSTH = 10
 
const int COSTD = 14
 
- Properties inherited from CityBuilderCore.GridPathfindingBase
bool AllowDiagonal [get, set]
 
bool AllowInvalid [get, set]
 

Member Function Documentation

◆ FindPath()

override WalkingPath CityBuilderCore.GridPathfinding.FindPath ( Vector2Int[] starts,
Vector2Int[] targets,
object tag = null )
inline

attempts to find a path between one of the starts and one of the ends

Parameters
startscollection of one or more possible start points
targetscollection of one or more possible start points
tagadditional pathfinding parameter(road type, walker info, ...)
Returns
the calculated path or null when no path was found

Implements CityBuilderCore.IPathfinder.

◆ FindPathQuery()

override PathQuery CityBuilderCore.GridPathfinding.FindPathQuery ( Vector2Int[] starts,
Vector2Int[] targets,
object tag = null )
inline

◆ HasPoint()

override bool CityBuilderCore.GridPathfinding.HasPoint ( Vector2Int point,
object tag = null )
inline

checks if a point exists within the pathfinder
for example points on map pathing that are blocked or points for road pathing that dont have a road

Parameters
pointthe map point to check
tagadditional pathfinding parameter(road type, walker info, ...)
Returns
whether the point exists in the pathfinder

Implements CityBuilderCore.IPathfinder.