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

Some utilitary methods. More...

Static Public Member Functions

static Vector2Int NextNodeDirectionToVector2Int (TileDirection direction)
 Converts a TileDirection to a Vector2Int.
 
static TileDirection GetDirectionBetweenAdjacentTiles (ITile tileA, ITile tileB)
 Gets the direction between two adjacent tiles.
 
static bool TileEquals< T > (T tileA, T tileB)
 Compare two tiles to check if they share the same coordinates values.
 
static Vector2Int ClampCoordsIntoGrid< T > (T[,] grid, int x, int y)
 Return clamped coordinates into the grid.
 
static bool AreCoordsIntoGrid< T > (T[,] grid, int x, int y)
 Check if specific coordinates are into the grid range.
 
static T GetTile< T > (T[,] grid, int x, int y)
 Returns a tile from the grid at specific coordinates.
 
static int GetHorizontalLength< T > (T[,] grid)
 Returns the horizontal length of a grid.
 
static int GetVerticalLength< T > (T[,] grid)
 Returns the vertical length of a grid.
 

Detailed Description

Some utilitary methods.

Member Function Documentation

◆ AreCoordsIntoGrid< T >()

static bool Caskev.GridToolkit.GridUtils.AreCoordsIntoGrid< T > ( grid[,],
int  x,
int  y 
)
static

Check if specific coordinates are into the grid range.

Template Parameters
TAny type
Parameters
gridA two-dimensional array
xHorizontal coordinate to check
yVertical coordinate to check
Returns
A boolean value

◆ ClampCoordsIntoGrid< T >()

static Vector2Int Caskev.GridToolkit.GridUtils.ClampCoordsIntoGrid< T > ( grid[,],
int  x,
int  y 
)
static

Return clamped coordinates into the grid.

Template Parameters
TAny type
Parameters
gridA two-dimensional array
xHorizontal coordinate to clamp
yVertical coordinate to clamp
Returns
A Vector2Int representing the clamped coordinates

◆ GetDirectionBetweenAdjacentTiles()

static TileDirection Caskev.GridToolkit.GridUtils.GetDirectionBetweenAdjacentTiles ( ITile  tileA,
ITile  tileB 
)
static

Gets the direction between two adjacent tiles.

Parameters
tileAThe first tile
tileBThe second tile
Returns
The direction from the first tile to the second tile.

◆ GetHorizontalLength< T >()

static int Caskev.GridToolkit.GridUtils.GetHorizontalLength< T > ( grid[,])
static

Returns the horizontal length of a grid.

Template Parameters
TAny type
Parameters
gridA two-dimensional array
Returns
The horizontal length of a grid

◆ GetTile< T >()

static T Caskev.GridToolkit.GridUtils.GetTile< T > ( grid[,],
int  x,
int  y 
)
static

Returns a tile from the grid at specific coordinates.

Template Parameters
TAny type
Parameters
gridA two-dimensional array
xHorizontal coordinate of the tile
yVertical coordinate of the tile
Returns
A tile


◆ GetVerticalLength< T >()

static int Caskev.GridToolkit.GridUtils.GetVerticalLength< T > ( grid[,])
static

Returns the vertical length of a grid.

Template Parameters
TAny type
Parameters
gridA two-dimensional array
Returns
The vertical length of a grid

◆ NextNodeDirectionToVector2Int()

static Vector2Int Caskev.GridToolkit.GridUtils.NextNodeDirectionToVector2Int ( TileDirection  direction)
static

Converts a TileDirection to a Vector2Int.

Parameters
directionThe TileDirection enumeration case
Returns
The corresponding Vector2Int

◆ TileEquals< T >()

static bool Caskev.GridToolkit.GridUtils.TileEquals< T > ( tileA,
tileB 
)
static

Compare two tiles to check if they share the same coordinates values.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
tileAThe first tile
tileBThe second tile
Returns
A boolean value
Type Constraints
T :ITile 

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