Table of Contents

Class ChunkCellStorage

Namespace
TileWorld.Engine.World.Chunks
Assembly
TileWorld.Engine.dll

Provides safe indexed access over the fixed-size cell array owned by a chunk.

public sealed class ChunkCellStorage
Inheritance
ChunkCellStorage
Inherited Members

Constructors

ChunkCellStorage()

Creates an empty fixed-size chunk cell buffer.

public ChunkCellStorage()

Properties

Count

Gets the total number of cells stored by the buffer.

public int Count { get; }

Property Value

int

Methods

GetCell(int, int)

Reads a cell from local chunk coordinates.

public TileCell GetCell(int localX, int localY)

Parameters

localX int

The local X coordinate.

localY int

The local Y coordinate.

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

localX int

The local X coordinate.

localY int

The local Y coordinate.

Returns

bool

true when the coordinate is inside the buffer bounds.

SetCell(int, int, TileCell)

Writes a cell to local chunk coordinates.

public void SetCell(int localX, int localY, TileCell cell)

Parameters

localX int

The local X coordinate.

localY int

The local Y coordinate.

cell TileCell

The 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

localX int

The local X coordinate.

localY int

The local Y coordinate.

Returns

int

The row-major cell index.