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

Allows you to cast lines of sight and cones of vision on a grid. More...

Static Public Member Functions

static bool IsLineOfSightClear< T > (T[,] grid, T startTile, T destinationTile, bool allowDiagonals=true, bool favorVertical=false)
 Is the line of sight clear between two tiles.
 
static bool IsLineOfSightClear< T > (T[,] grid, T startTile, int length, float directionAngle, bool allowDiagonals=true, bool favorVertical=false)
 Is the line of sight clear between two tiles.
 
static bool IsLineOfSightClear< T > (T[,] grid, T startTile, int length, Vector2 direction, bool allowDiagonals=true, bool favorVertical=false)
 Is the line of sight clear between two tiles.
 
static bool IsLineOfSightClear< T > (T[,] grid, T startTile, Vector2Int endPosition, bool allowDiagonals=true, bool favorVertical=false)
 Is the line of sight clear between two tiles.
 
static bool IsConeOfVisionClear< T > (T[,] grid, T startTile, float openingAngle, T destinationTile)
 Is the line of sight clear between two tiles.
 
static bool IsConeOfVisionClear< T > (T[,] grid, T startTile, int length, float openingAngle, float directionAngle)
 Is the line of sight clear between two tiles.
 
static bool IsConeOfVisionClear< T > (T[,] grid, T startTile, int length, float openingAngle, Vector2 direction)
 Is the line of sight clear between two tiles.
 
static bool IsConeOfVisionClear< T > (T[,] grid, T startTile, float openingAngle, Vector2Int endPosition)
 Is the line of sight clear between two tiles.
 
static T[] GetLineOfSight< T > (T[,] grid, T startTile, T destinationTile, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetLineOfSight< T > (T[,] grid, T startTile, int length, float directionAngle, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetLineOfSight< T > (T[,] grid, T startTile, int length, Vector2 direction, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetLineOfSight< T > (T[,] grid, T startTile, Vector2Int endPosition, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetLineOfSight< T > (T[,] grid, out bool isClear, T startTile, T destinationTile, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetLineOfSight< T > (T[,] grid, out bool isClear, T startTile, int length, float directionAngle, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetLineOfSight< T > (T[,] grid, out bool isClear, T startTile, int length, Vector2 direction, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetLineOfSight< T > (T[,] grid, out bool isClear, T startTile, Vector2Int endPosition, bool allowDiagonals=false, bool favorVertical=false, bool includeStart=true)
 Get all tiles on a line of sight from a start tile.

 
static T[] GetConeOfVision< T > (T[,] grid, T startTile, float openingAngle, T destinationTile, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 
static T[] GetConeOfVision< T > (T[,] grid, T startTile, int length, float openingAngle, float directionAngle, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 
static T[] GetConeOfVision< T > (T[,] grid, T startTile, int length, float openingAngle, Vector2 direction, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 
static T[] GetConeOfVision< T > (T[,] grid, T startTile, float openingAngle, Vector2Int endPosition, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 
static T[] GetConeOfVision< T > (T[,] grid, out bool isClear, T startTile, float openingAngle, T destinationTile, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 
static T[] GetConeOfVision< T > (T[,] grid, out bool isClear, T startTile, int length, float openingAngle, float directionAngle, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 
static T[] GetConeOfVision< T > (T[,] grid, out bool isClear, T startTile, int length, float openingAngle, Vector2 direction, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 
static T[] GetConeOfVision< T > (T[,] grid, out bool isClear, T startTile, float openingAngle, Vector2Int endPosition, bool includeStart=true)
 Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.
 

Detailed Description

Allows you to cast lines of sight and cones of vision on a grid.

Member Function Documentation

◆ GetConeOfVision< T >() [1/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
out bool  isClear,
startTile,
float  openingAngle,
destinationTile,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
openingAngleThe cone opening angle in degrees [1-360]
destinationTileThe destination tile at the end of the cone
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetConeOfVision< T >() [2/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
out bool  isClear,
startTile,
float  openingAngle,
Vector2Int  endPosition,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
openingAngleThe cone opening angle in degrees [1-360]
endPositionThe destination virtual coordinates (do not need to be into grid range)
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetConeOfVision< T >() [3/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
out bool  isClear,
startTile,
int  length,
float  openingAngle,
float  directionAngle,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
lengthThe length of the line
openingAngleThe cone opening angle in degrees [1-360]
directionAngleThe angle of the line from the start tile
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetConeOfVision< T >() [4/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
out bool  isClear,
startTile,
int  length,
float  openingAngle,
Vector2  direction,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
lengthThe length of the line
openingAngleThe cone opening angle in degrees [1-360]
directionThe direction of the line from the start tile
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetConeOfVision< T >() [5/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
startTile,
float  openingAngle,
destinationTile,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
openingAngleThe cone opening angle in degrees [1-360]
destinationTileThe destination tile at the end of the cone
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetConeOfVision< T >() [6/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
startTile,
float  openingAngle,
Vector2Int  endPosition,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
openingAngleThe cone opening angle in degrees [1-360]
endPositionThe destination virtual coordinates (do not need to be into grid range)
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetConeOfVision< T >() [7/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
startTile,
int  length,
float  openingAngle,
float  directionAngle,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the line
openingAngleThe cone opening angle in degrees [1-360]
directionAngleThe angle of the line from the start tile
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetConeOfVision< T >() [8/8]

static T[] Caskev.GridToolkit.Raycasting.GetConeOfVision< T > ( grid[,],
startTile,
int  length,
float  openingAngle,
Vector2  direction,
bool  includeStart = true 
)
static

Get all visible tiles from a start tile's cone of vision
Note that the order of the tiles into the returned array is not guaranteed.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the line
openingAngleThe cone opening angle in degrees [1-360]
directionThe direction of the line from the start tile
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [1/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
out bool  isClear,
startTile,
int  length,
float  directionAngle,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
lengthThe length of the line
directionAngleThe angle of the line from the start tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [2/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
out bool  isClear,
startTile,
int  length,
Vector2  direction,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
lengthThe length of the line
directionThe direction of the line from the start tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [3/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
out bool  isClear,
startTile,
destinationTile,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
destinationTileThe destination tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
A boolean value
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [4/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
out bool  isClear,
startTile,
Vector2Int  endPosition,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
isClearIs the line of sight clear (no non-walkable tile encountered)
startTileThe start tile
endPositionThe destination virtual coordinates (do not need to be into grid range)
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [5/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
startTile,
int  length,
float  directionAngle,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the line
directionAngleThe angle of the line from the start tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [6/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
startTile,
int  length,
Vector2  direction,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the line
directionThe direction of the line from the start tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [7/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
startTile,
destinationTile,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
destinationTileThe destination tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
A boolean value
Type Constraints
T :ITile 

◆ GetLineOfSight< T >() [8/8]

static T[] Caskev.GridToolkit.Raycasting.GetLineOfSight< T > ( grid[,],
startTile,
Vector2Int  endPosition,
bool  allowDiagonals = false,
bool  favorVertical = false,
bool  includeStart = true 
)
static

Get all tiles on a line of sight from a start tile.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
endPositionThe destination virtual coordinates (do not need to be into grid range)
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
includeStartInclude the start tile into the resulting array or not. Default is true
Returns
An array of tiles
Type Constraints
T :ITile 

◆ IsConeOfVisionClear< T >() [1/4]

static bool Caskev.GridToolkit.Raycasting.IsConeOfVisionClear< T > ( grid[,],
startTile,
float  openingAngle,
destinationTile 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
openingAngleThe cone opening angle in degrees [1-360]
destinationTileThe destination tile
Returns
A boolean value
Type Constraints
T :ITile 

◆ IsConeOfVisionClear< T >() [2/4]

static bool Caskev.GridToolkit.Raycasting.IsConeOfVisionClear< T > ( grid[,],
startTile,
float  openingAngle,
Vector2Int  endPosition 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
openingAngleThe cone opening angle in degrees [1-360]
endPositionThe destination virtual coordinates (do not need to be into grid range)
Returns
A boolean value
Type Constraints
T :ITile 

◆ IsConeOfVisionClear< T >() [3/4]

static bool Caskev.GridToolkit.Raycasting.IsConeOfVisionClear< T > ( grid[,],
startTile,
int  length,
float  openingAngle,
float  directionAngle 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the cone
openingAngleThe cone opening angle in degrees [1-360]
directionAngleThe angle of the line from the start tile
Returns
A boolean value
Type Constraints
T :ITile 

◆ IsConeOfVisionClear< T >() [4/4]

static bool Caskev.GridToolkit.Raycasting.IsConeOfVisionClear< T > ( grid[,],
startTile,
int  length,
float  openingAngle,
Vector2  direction 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the cone
openingAngleThe cone opening angle in degrees [1-360]
directionThe direction of the line from the start tile
Returns
A boolean value
Type Constraints
T :ITile 

◆ IsLineOfSightClear< T >() [1/4]

static bool Caskev.GridToolkit.Raycasting.IsLineOfSightClear< T > ( grid[,],
startTile,
int  length,
float  directionAngle,
bool  allowDiagonals = true,
bool  favorVertical = false 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the line
directionAngleThe angle of the line from the start tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
Returns
A boolean value
Type Constraints
T :ITile 

◆ IsLineOfSightClear< T >() [2/4]

static bool Caskev.GridToolkit.Raycasting.IsLineOfSightClear< T > ( grid[,],
startTile,
int  length,
Vector2  direction,
bool  allowDiagonals = true,
bool  favorVertical = false 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
lengthThe length of the line
directionThe direction of the line from the start tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
Returns
A boolean value
Type Constraints
T :ITile 

◆ IsLineOfSightClear< T >() [3/4]

static bool Caskev.GridToolkit.Raycasting.IsLineOfSightClear< T > ( grid[,],
startTile,
destinationTile,
bool  allowDiagonals = true,
bool  favorVertical = false 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
destinationTileThe destination tile
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
Returns
A boolean value
Type Constraints
T :ITile 

◆ IsLineOfSightClear< T >() [4/4]

static bool Caskev.GridToolkit.Raycasting.IsLineOfSightClear< T > ( grid[,],
startTile,
Vector2Int  endPosition,
bool  allowDiagonals = true,
bool  favorVertical = false 
)
static

Is the line of sight clear between two tiles.

Template Parameters
TThe user-defined type representing a tile (needs to implement the ITile interface)
Parameters
gridA two-dimensional array of tiles
startTileThe start tile
endPositionThe destination virtual coordinates (do not need to be into grid range)
allowDiagonalsAllows the diagonals or not. Default is true
favorVerticalIf diagonals are disabled then favor vertical when a diagonal should have been used. False will favor horizontal and is the default value.
Returns
A boolean value
Type Constraints
T :ITile 

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