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

A DirectionAtlas object holds DirectionGrid objects for each tile.
More...

Collaboration diagram for Caskev.GridToolkit.DirectionAtlas:
[legend]

Public Member Functions

bool HasPath< T > (T[,] grid, T startTile, T destinationTile)
 Is there a path between two tiles.
 
GetNextTile< T > (T[,] grid, T startTile, T destinationTile)
 Get the next tile on the path between a start tile and a destination tile.
 
TileDirection GetNextDirection< T > (T[,] grid, T startTile, T destinationTile)
 Get the next tile on the path between a start tile and a destination tile.
 
T[] GetPath< T > (T[,] grid, T startTile, T destinationTile, bool includeStart=true, bool includeDestination=true)
 Get all the tiles on the path from a start tile to a destination tile. If there is no path between the two tiles then an empty array will be returned.
 
byte[] ToByteArray ()
 Serializes a DirectionAtlas to a byte array.
 
Task< byte[]> ToByteArrayAsync (IProgress< float > progress=null, CancellationToken cancelToken=default)
 Asynchronously serializes a DirectionAtlas to a byte array.
 
async Awaitable< byte[]> ToByteArrayAwaitable (IProgress< float > progress=null, CancellationToken cancelToken=default)
 Asynchronously serializes a DirectionAtlas to a byte array.
 

Static Public Member Functions

static DirectionAtlas FromByteArray< T > (T[,] grid, byte[] bytes)
 Deserializes a DirectionAtlas from a byte array.
 
static Task< DirectionAtlasFromByteArrayAsync< T > (T[,] grid, byte[] bytes, IProgress< float > progress=null, CancellationToken cancelToken=default)
 Asynchronously deserializes a DirectionAtlas from a byte array.
 
static async Awaitable< DirectionAtlasFromByteArrayAwaitable< T > (T[,] grid, byte[] bytes, IProgress< float > progress=null, CancellationToken cancelToken=default)
 Asynchronously deserializes a DirectionAtlas from a byte array.
 

Detailed Description

A DirectionAtlas object holds DirectionGrid objects for each tile.

Member Function Documentation

◆ FromByteArray< T >()

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

Deserializes a DirectionAtlas from a byte array.

Parameters
gridThe user grid.
bytesThe serialized DirectionAtlas.
Returns
The deserialized DirectionAtlas.
Type Constraints
T :ITile 

◆ FromByteArrayAsync< T >()

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

Asynchronously deserializes a DirectionAtlas from a byte array.

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

◆ FromByteArrayAwaitable< T >()

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

Asynchronously deserializes a DirectionAtlas from a byte array.

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

◆ GetNextDirection< T >()

TileDirection Caskev.GridToolkit.DirectionAtlas.GetNextDirection< T > ( grid[,],
startTile,
destinationTile 
)

Get the next tile on the path between a start tile and a destination tile.

Parameters
gridThe user grid
startTileThe start tile
destinationTileThe destination tile
Returns
A Vector2Int direction
Type Constraints
T :ITile 

◆ GetNextTile< T >()

T Caskev.GridToolkit.DirectionAtlas.GetNextTile< T > ( grid[,],
startTile,
destinationTile 
)

Get the next tile on the path between a start tile and a destination tile.

Parameters
gridThe user grid
startTileThe start tile
destinationTileThe destination tile
Returns
A tile object
Type Constraints
T :ITile 

◆ GetPath< T >()

T[] Caskev.GridToolkit.DirectionAtlas.GetPath< T > ( grid[,],
startTile,
destinationTile,
bool  includeStart = true,
bool  includeDestination = true 
)

Get all the tiles on the path from a start tile to a destination tile. If there is no path between the two tiles then an empty array will be returned.

Parameters
gridThe user grid
startTileThe start tile
destinationTileThe destination tile
includeStartInclude the start tile into the resulting array or not. Default is true
includeDestinationInclude the target tile into the resulting array or not
Returns
An array of tiles
Type Constraints
T :ITile 

◆ HasPath< T >()

bool Caskev.GridToolkit.DirectionAtlas.HasPath< T > ( grid[,],
startTile,
destinationTile 
)

Is there a path between two tiles.

Parameters
gridThe user grid
startTileThe start tile
destinationTileThe destination tile
Returns
A boolean value
Type Constraints
T :ITile 

◆ ToByteArray()

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

Serializes a DirectionAtlas to a byte array.

Returns
The serialized DirectionAtlas.

◆ ToByteArrayAsync()

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

Asynchronously serializes a DirectionAtlas to a byte array.

Parameters
progressAn optional IProgress object to get the deserialization progression
cancelTokenAn optional CancellationToken object to cancel the serialization
Returns
The serialized DirectionAtlas.

◆ ToByteArrayAwaitable()

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

Asynchronously serializes a DirectionAtlas to a byte array.

Parameters
progressAn optional IProgress object to get the deserialization progression
cancelTokenAn optional CancellationToken object to cancel the serialization
Returns
The serialized DirectionAtlas.

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