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

A DirectionGrid object holds direction data between a target tile and all the tiles that are accessible to this target, on the entire grid.
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.
 
byte[] ToByteArray ()
 Returns the DirectionGrid serialized as a byte array.
 
Task< byte[]> ToByteArrayAsync (IProgress< float > progress=null, CancellationToken cancelToken=default)
 Returns the DirectionGrid serialized as a byte array.
 
async Awaitable< byte[]> ToByteArrayAwaitable (IProgress< float > progress=null, CancellationToken cancelToken=default)
 Returns the DirectionGrid serialized as a byte array.
 

Static Public Member Functions

static DirectionGrid FromByteArray< T > (T[,] grid, byte[] bytes)
 Returns a DirectionGrid from a byte array that has been serialized with the ToByteArray method.
 
static Task< DirectionGridFromByteArrayAsync< T > (T[,] grid, byte[] bytes, IProgress< float > progress=null, CancellationToken cancelToken=default)
 Returns a DirectionGrid from a byte array that has been serialized with the ToByteArray method.
 
static async Awaitable< DirectionGridFromByteArrayAwaitable< T > (T[,] grid, byte[] bytes, IProgress< float > progress=null, CancellationToken cancelToken=default)
 Returns a DirectionGrid from a byte array that has been serialized with the ToByteArray method.
 

Detailed Description

A DirectionGrid object holds direction data between a target tile and all the tiles that are accessible to this target, on the entire grid.

Member Function Documentation

◆ FromByteArray< T >()

static DirectionGrid Caskev.GridToolkit.DirectionGrid.FromByteArray< T > ( grid[,],
byte[]  bytes 
)
static

Returns a DirectionGrid from a byte array that has been serialized with the ToByteArray method.

Parameters
gridThe user grid
bytesThe serialized byte array
Returns
The deserialized DirectionGrid
Type Constraints
T :ITile 

◆ FromByteArrayAsync< T >()

static Task< DirectionGrid > Caskev.GridToolkit.DirectionGrid.FromByteArrayAsync< T > ( grid[,],
byte[]  bytes,
IProgress< float >  progress = null,
CancellationToken  cancelToken = default 
)
static

Returns a DirectionGrid from a byte array that has been serialized with the ToByteArray method.

Parameters
gridThe user grid
bytesThe serialized byte array
progressAn optional IProgress object to get the deserialization progression
cancelTokenAn optional CancellationToken object to cancel the deserialization
Returns
The deserialized DirectionGrid
Type Constraints
T :ITile 

◆ FromByteArrayAwaitable< T >()

static async Awaitable< DirectionGrid > Caskev.GridToolkit.DirectionGrid.FromByteArrayAwaitable< T > ( grid[,],
byte[]  bytes,
IProgress< float >  progress = null,
CancellationToken  cancelToken = default 
)
static

Returns a DirectionGrid from a byte array that has been serialized with the ToByteArray method.

Parameters
gridThe user grid
bytesThe serialized byte array
progressAn optional IProgress object to get the deserialization progression
cancelTokenAn optional CancellationToken object to cancel the deserialization
Returns
The deserialized DirectionGrid
Type Constraints
T :ITile 

◆ GetNextDirection< T >()

TileDirection Caskev.GridToolkit.DirectionGrid.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.DirectionGrid.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.DirectionGrid.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.DirectionGrid.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.DirectionGrid.GetTargetTile< T > ( grid[,])

Returns the target tile.

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

◆ IsTileAccessible< T >()

bool Caskev.GridToolkit.DirectionGrid.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 

◆ ToByteArray()

byte[] Caskev.GridToolkit.DirectionGrid.ToByteArray ( )

Returns the DirectionGrid serialized as a byte array.

Returns
A byte array representing the serialized DirectionGrid

◆ ToByteArrayAsync()

Task< byte[]> Caskev.GridToolkit.DirectionGrid.ToByteArrayAsync ( IProgress< float >  progress = null,
CancellationToken  cancelToken = default 
)

Returns the DirectionGrid serialized as a byte array.

Parameters
progressAn optional IProgress object to get the serialization progression
cancelTokenAn optional CancellationToken object to cancel the serialization
Returns
A byte array representing the serialized DirectionGrid

◆ ToByteArrayAwaitable()

async Awaitable< byte[]> Caskev.GridToolkit.DirectionGrid.ToByteArrayAwaitable ( IProgress< float >  progress = null,
CancellationToken  cancelToken = default 
)

Returns the DirectionGrid serialized as a byte array.

Parameters
progressAn optional IProgress object to get the serialization progression
cancelTokenAn optional CancellationToken object to cancel the serialization
Returns
A byte array representing the serialized DirectionGrid

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