Class OffGrid
Assembly: Sylves.dll
Syntax
public class OffGrid : PlanarLazyGrid, IGrid
Constructors
OffGrid(float, SquareBound, int?, ICachePolicy)
Declaration
public OffGrid(float minSize = 0.2, SquareBound bound = null, int? seed = null, ICachePolicy cachePolicy = null)
Parameters
Properties
Unbounded
Returns the grid with any bounds removed.
Declaration
public override IGrid Unbounded { get; }
Property Value
Overrides
Methods
BoundBy(IBound)
Returns a new grid restricted to just the given bound.
If the grid already has a bound, the new grid will have the intersection of both.
Declaration
public override IGrid BoundBy(IBound bound)
Parameters
| Type |
Name |
Description |
| IBound |
bound |
|
Returns
Overrides
Combine(Cell, Cell)
Declaration
protected override Cell Combine(Cell childCell, Cell chunkCell)
Parameters
| Type |
Name |
Description |
| Cell |
childCell |
|
| Cell |
chunkCell |
|
Returns
Overrides
GetAdjacentChunks(Cell)
Declaration
protected override IEnumerable<Cell> GetAdjacentChunks(Cell chunkCell)
Parameters
| Type |
Name |
Description |
| Cell |
chunkCell |
|
Returns
Overrides
GetChildGrid(Cell)
The grid associated with each chunk. This grid has extra requirements:
- It should only use the x-coordinate of the cell. The other two should be zero, (to be offset by the chunk position)
- The dest of moves is also offset by the chunk position. Moves may be off grid (illegal in a normal grid)
As building a grid with off-grid moves is difficult, you can also just override TryMove to whatever.
Declaration
protected override IGrid GetChildGrid(Cell v)
Parameters
| Type |
Name |
Description |
| Cell |
v |
|
Returns
Overrides
Split(Cell)
Declaration
protected override (Cell childCell, Cell chunkCell) Split(Cell cell)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
|
Returns
Overrides
TryMove(Cell, CellDir, out Cell, out CellDir, out Connection)
Attempts to move from a cell in a given direction, and returns information about the move if successful.
Declaration
public override bool TryMove(Cell cell, CellDir dir, out Cell dest, out CellDir inverseDir, out Connection connection)
Parameters
| Type |
Name |
Description |
| Cell |
cell |
The cell to move from
|
| CellDir |
dir |
The direction to move in
|
| Cell |
dest |
The cell moved to
|
| CellDir |
inverseDir |
The direction leading back from dest to cell.
|
| Connection |
connection |
A descriptor of how cell-local space relates between cell and dest.
|
Returns
Overrides
Implements
Extension Methods