Interface IGrid
Represents a arrangement of cells, including their adjacency and locations.
Cells are uniquely identified by a Vector3Int.
Tessera.IGrid is roughly equivalent to DeBroglie.Topo.ITopology.
Assembly: cs.temp.dll.dll
Syntax
Properties
CellType
Describes what sort of cell can be found in this grid
Declaration
ICellType CellType { get; }
Property Value
IndexCount
Finds a number one larger than the maximum index for an in bounds cell.
Declaration
Property Value
Methods
FindCell(Vector3, Matrix4x4, out Vector3Int, out CellRotation)
Returns the cell and rotation for a tile placed in the grid.
NB: The cell returned corresponds to offset (0,0,0). The tile may not actually occupy that offset.
Declaration
bool FindCell(Vector3 tileCenter, Matrix4x4 tileLocalToGridMatrix, out Vector3Int cell, out CellRotation rotation)
Parameters
Type |
Name |
Description |
Vector3 |
tileCenter |
|
Matrix4x4 |
tileLocalToGridMatrix |
|
Vector3Int |
cell |
|
CellRotation |
rotation |
|
Returns
FindCell(Vector3, out Vector3Int)
Finds the cell containg the give position
Declaration
bool FindCell(Vector3 position, out Vector3Int cell)
Parameters
Type |
Name |
Description |
Vector3 |
position |
|
Vector3Int |
cell |
|
Returns
GetCell(Int32)
Finds the cell associated with a given index.
Declaration
Vector3Int GetCell(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Returns
Type |
Description |
Vector3Int |
|
GetCellCenter(Vector3Int)
Returns the center of the cell in local space
Declaration
Vector3 GetCellCenter(Vector3Int cell)
Parameters
Type |
Name |
Description |
Vector3Int |
cell |
|
Returns
GetCells()
Gets a full list of cells in bounds.
Declaration
IEnumerable<Vector3Int> GetCells()
Returns
GetCellsIntersectsApprox(Bounds)
Gets the set of cells that potentially overlap bounds.
Declaration
IEnumerable<Vector3Int> GetCellsIntersectsApprox(Bounds bounds)
Parameters
Type |
Name |
Description |
Bounds |
bounds |
|
Returns
GetIndex(Vector3Int)
Finds the index associated with a given cell. Cell must be in bounds.
Declaration
int GetIndex(Vector3Int cell)
Parameters
Type |
Name |
Description |
Vector3Int |
cell |
|
Returns
GetMoveRotations()
Returns the full set of rotations that TryMove can output.
Can just default to CellType.GetRotations();
Declaration
IEnumerable<CellRotation> GetMoveRotations()
Returns
GetTRS(Vector3Int)
Returns the appropriate transform for the cell.
The translation will always be to GetCellCenter.
Not inclusive of cell rotation, that should be applied first.
Declaration
TRS GetTRS(Vector3Int cell)
Parameters
Type |
Name |
Description |
Vector3Int |
cell |
|
Returns
GetValidFaceDirs(Vector3Int)
Returns directions we might expect TryMove to work for (though it is not guaranteed).
This is mostly useful for heterogenous grids where not every cell is identical.
Declaration
IEnumerable<CellFaceDir> GetValidFaceDirs(Vector3Int cell)
Parameters
Type |
Name |
Description |
Vector3Int |
cell |
|
Returns
InBounds(Vector3Int)
Returns true if the cell is actually in the size specified.
Some grids support out of bounds cells, in which case operations like TryMove may need to be filtered.
Declaration
bool InBounds(Vector3Int cell)
Parameters
Type |
Name |
Description |
Vector3Int |
cell |
|
Returns
TryMove(Vector3Int, CellFaceDir, out Vector3Int, out CellFaceDir, out CellRotation)
Attempts to move from a face in a given direction, and returns information about the move if successful.
Note that for some grids, this can succeed, and return a cell outside of bounds.
Declaration
bool TryMove(Vector3Int cell, CellFaceDir faceDir, out Vector3Int dest, out CellFaceDir inverseFaceDir, out CellRotation rotation)
Parameters
Returns
TryMoveByOffset(Vector3Int, Vector3Int, CellRotation, out Vector3Int)
Declaration
bool TryMoveByOffset(Vector3Int cell, Vector3Int offset, CellRotation offsetRotation, out Vector3Int dest)
Parameters
Type |
Name |
Description |
Vector3Int |
cell |
|
Vector3Int |
offset |
|
CellRotation |
offsetRotation |
|
Vector3Int |
dest |
|
Returns