Interface IGrid<TCell, TPoint>
The base class of all types of grids.
Grids are similar to 2D arrays.Elements in the grid are called cells.Grids support random access to cells through grid points(IGridPoint), using square bracket syntax.
Cell cell = squareGrid[squarePoint]; Most grids support enumeration of points, making it possible to useLINQ on grids as well.
foreach(var point in grid) doSomethingWithCell(grid[point]); var pointsThatSatsifyPointPredicate = grid.Where(pointPredicate);
General algorithms are provided in Algorithms. If you want to implement your own grid, you can implement th is interface to have your grid work with many grid algorithms.
[Version(1, 0, 0)]
public interface IGrid<TCell, TPoint> : IGrid<TPoint>, IGridSpace<TPoint>, IEnumerable<TPoint>, IEnumerable where TPoint : IGridPoint<TPoint>
Type Parameters
TCellTPoint
- Inherited Members
- Extension Methods
Properties
this[TPoint]
Accesses a cell in the given point.
TCell this[TPoint point] { get; set; }
Parameters
pointTPoint
Property Value
- TCell
Values
A enumerable containing all the values of this grid.
IEnumerable<TCell> Values { get; }
Property Value
- IEnumerable<TCell>
Examples
For example, the following two pieces of code do the same:
foreach(var point in grid)
{
Debug.Log(grid[point]);
}
foreach(var value in grid.Values)
{
Debug.Log(value);
}