Table of Contents

Class ScanCell

Namespace
GridForge.Grids
Assembly
GridForge.dll

Represents a spatial partition within a grid, managing occupants at a finer granularity than grid voxels. Handles efficient tracking, retrieval, and removal of occupants within a designated scan cell area.

public class ScanCell
Inheritance
ScanCell
Inherited Members

Constructors

ScanCell()

public ScanCell()

Properties

CellKey

A unique identifier for this scan cell in the grid.

public int CellKey { get; }

Property Value

int

CellOccupantCount

The total number of occupants in this scan cell.

public int CellOccupantCount { get; }

Property Value

int

GridIndex

The world-local index of the grid this scan cell belongs to.

public ushort GridIndex { get; }

Property Value

ushort

IsAllocated

Indicates whether this scan cell is currently allocated in the grid.

public bool IsAllocated { get; }

Property Value

bool

IsOccupied

Determines whether this scan cell is occupied by any occupants. A scan cell is only considered occupied if it is allocated and contains at least one occupant.

public bool IsOccupied { get; }

Property Value

bool

World

The world that owns this scan cell through its parent grid.

public GridWorld? World { get; }

Property Value

GridWorld

Methods

GetConditionalOccupants(Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Retrieves occupants whose group Ids match a given condition.

public IEnumerable<IVoxelOccupant> GetConditionalOccupants(Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupConditional = null)

Parameters

occupantCondition Func<IVoxelOccupant, bool>
groupConditional Func<byte, bool>

Returns

IEnumerable<IVoxelOccupant>

GetHashCode()

public override int GetHashCode()

Returns

int

GetOccupants()

Retrieves all occupants associated with this ScanCell.

public IEnumerable<IVoxelOccupant> GetOccupants()

Returns

IEnumerable<IVoxelOccupant>

An enumerable of occupants within this scan cell.

GetOccupantsFor(WorldVoxelIndex)

Retrieves all occupants associated with a specific voxel spawn token within this scan cell.

public IEnumerable<IVoxelOccupant> GetOccupantsFor(WorldVoxelIndex index)

Parameters

index WorldVoxelIndex

The global index of the voxel.

Returns

IEnumerable<IVoxelOccupant>

An enumerable collection of occupants assigned to the voxel.

TryGetOccupantAt(WorldVoxelIndex, OccupantTicket, out IVoxelOccupant?)

Attempts to retrieve a specific occupant in this scan cell using a voxel's spawn key and occupant ticket.

public bool TryGetOccupantAt(WorldVoxelIndex index, OccupantTicket occupantTicket, out IVoxelOccupant? voxelOccupant)

Parameters

index WorldVoxelIndex

The global index of the voxel the occupant belongs to.

occupantTicket OccupantTicket

The unique ticket identifying the occupant.

voxelOccupant IVoxelOccupant

The retrieved occupant if found.

Returns

bool

True if the occupant was found, otherwise false.