Class Chunk
Stores cell data and runtime state for a single chunk.
public sealed class Chunk
- Inheritance
-
Chunk
- Inherited Members
Constructors
Chunk(ChunkCoord)
Creates a chunk with a fresh cell buffer at the supplied coordinate.
public Chunk(ChunkCoord coord)
Parameters
coordChunkCoordThe chunk coordinate.
Chunk(ChunkCoord, ChunkCellStorage)
Creates a chunk with an explicit cell buffer.
public Chunk(ChunkCoord coord, ChunkCellStorage cellStorage)
Parameters
coordChunkCoordThe chunk coordinate.
cellStorageChunkCellStorageThe cell storage backing the chunk.
Properties
CellStorage
Gets the cell storage backing this chunk.
public ChunkCellStorage CellStorage { get; }
Property Value
Coord
Gets the coordinate of the chunk.
public ChunkCoord Coord { get; }
Property Value
DirtyFlags
Gets or sets the dirty flags currently applied to the chunk.
public ChunkDirtyFlags DirtyFlags { get; set; }
Property Value
State
Gets or sets the chunk lifecycle state.
public ChunkState State { get; set; }
Property Value
Methods
GetCell(int, int)
Reads a cell from local chunk coordinates.
public TileCell GetCell(int localX, int localY)
Parameters
Returns
- TileCell
The resolved cell value.
IsInside(int, int)
Returns whether the supplied local coordinate lies inside the chunk.
public bool IsInside(int localX, int localY)
Parameters
Returns
SetCell(int, int, TileCell)
Writes a cell to local chunk coordinates.
public void SetCell(int localX, int localY, TileCell cell)
Parameters
localXintThe local X coordinate.
localYintThe local Y coordinate.
cellTileCellThe cell value to store.
ToIndex(int, int)
Converts a local chunk coordinate into a row-major cell index.
public int ToIndex(int localX, int localY)
Parameters
Returns
- int
The row-major index into the chunk cell buffer.