Unity Grid Toolkit
Utilitary API to proceed operations on abstract grids such as tile extraction, raycasting, and pathfinding.
Loading...
Searching...
No Matches
Caskev.GridToolkit.DirectionField Class Reference

A DirectionField object holds direction data between a target tile and all the tiles that are accessible to this target into a specified maximum distance range.
More...

Public Member Functions

bool IsTileAccessible< T > (T[,] grid, T tile)
 Is the tile is accessible from the target.
 
GetTargetTile< T > (T[,] grid)
 Returns the target tile.
 
GetNextTile< T > (T[,] grid, T tile)
 Get the next tile on the path between a tile and the target.
 
TileDirection GetNextDirection< T > (T[,] grid, T tile)
 Get the next tile on the path between the target and a tile.
 
T[] GetPathToTarget< T > (T[,] grid, T startTile, bool includeStart=true, bool includeTarget=true)
 Get all the tiles on the path from a tile to the target.
 
T[] GetPathFromTarget< T > (T[,] grid, T destinationTile, bool includeDestination=true, bool includeTarget=true)
 Get all the tiles on the path from the target to a tile.
 
GetAccessibleTile< T > (T[,] grid, int index)
 Use this method to iterate though the accessible tiles. AccessibleTilesCount.
 
T[] GetAccessibleTiles< T > (T[,] grid)
 Returns the tiles that accessible to the target.
 
void GetAccessibleTilesNoAlloc< T > (T[,] grid, T[] accessibleTiles)
 Returns the tiles that accessible to the target.
 

Properties

int MaxDistance [get]
 The maximum distance used to generate this DirectionField.
 
int AccessibleTilesCount [get]
 Gets the total number of accessible tiles.
 

Detailed Description

A DirectionField object holds direction data between a target tile and all the tiles that are accessible to this target into a specified maximum distance range.

Member Function Documentation

◆ GetAccessibleTile< T >()

T Caskev.GridToolkit.DirectionField.GetAccessibleTile< T > ( grid[,],
int  index 
)

Use this method to iterate though the accessible tiles. AccessibleTilesCount.

Template Parameters
TThe type of the tile, which must implement the ITile interface.
Parameters
gridA two-dimensional array representing the grid of tiles.
indexThe zero-based index of the accessible tile in the accessible tiles list AccessibleTilesCount.
Returns
The tile of type T located at the specified index in the accessible tiles list.
Type Constraints
T :ITile 

◆ GetAccessibleTiles< T >()

T[] Caskev.GridToolkit.DirectionField.GetAccessibleTiles< T > ( grid[,])

Returns the tiles that accessible to the target.

Parameters
gridA two-dimensional array representing the grid of tiles.
Returns
The tiles that accessible to the target.
Type Constraints
T :IWeightedTile 

◆ GetAccessibleTilesNoAlloc< T >()

void Caskev.GridToolkit.DirectionField.GetAccessibleTilesNoAlloc< T > ( grid[,],
T[]  accessibleTiles 
)

Returns the tiles that accessible to the target.

Parameters
gridA two-dimensional array representing the grid of tiles.
accessibleTilesAn array of tiles in which the tiles will be stored.
Type Constraints
T :IWeightedTile 

◆ GetNextDirection< T >()

TileDirection Caskev.GridToolkit.DirectionField.GetNextDirection< T > ( grid[,],
tile 
)

Get the next tile on the path between the target and a tile.

Parameters
gridA two-dimensional array of tiles
tileThe tile
Returns
A Vector2Int direction
Type Constraints
T :ITile 

◆ GetNextTile< T >()

T Caskev.GridToolkit.DirectionField.GetNextTile< T > ( grid[,],
tile 
)

Get the next tile on the path between a tile and the target.

Parameters
gridA two-dimensional array of tiles
tileA tile
Returns
A tile object
Type Constraints
T :ITile 

◆ GetPathFromTarget< T >()

T[] Caskev.GridToolkit.DirectionField.GetPathFromTarget< T > ( grid[,],
destinationTile,
bool  includeDestination = true,
bool  includeTarget = true 
)

Get all the tiles on the path from the target to a tile.

Parameters
gridA two-dimensional array of tiles
destinationTileThe destination tile
includeDestinationInclude the destination tile into the resulting array or not. Default is true
includeTargetInclude the target tile into the resulting array or not
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetPathToTarget< T >()

T[] Caskev.GridToolkit.DirectionField.GetPathToTarget< T > ( grid[,],
startTile,
bool  includeStart = true,
bool  includeTarget = true 
)

Get all the tiles on the path from a tile to the target.

Parameters
gridA two-dimensional array of tiles
startTileThe start tile
includeStartInclude the start tile into the resulting array or not. Default is true
includeTargetInclude the target tile into the resulting array or not
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetTargetTile< T >()

T Caskev.GridToolkit.DirectionField.GetTargetTile< T > ( grid[,])

Returns the target tile.

Parameters
gridA two-dimensional array of tiles
Returns
Type Constraints
T :ITile 

◆ IsTileAccessible< T >()

bool Caskev.GridToolkit.DirectionField.IsTileAccessible< T > ( grid[,],
tile 
)

Is the tile is accessible from the target.

Parameters
gridA two-dimensional array of tiles
tileThe tile to check
Returns
A boolean value
Type Constraints
T :ITile 

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