Class ScanCell
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
CellOccupantCount
The total number of occupants in this scan cell.
public int CellOccupantCount { get; }
Property Value
GridIndex
The world-local index of the grid this scan cell belongs to.
public ushort GridIndex { get; }
Property Value
IsAllocated
Indicates whether this scan cell is currently allocated in the grid.
public bool IsAllocated { get; }
Property Value
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
World
The world that owns this scan cell through its parent grid.
public GridWorld? World { get; }
Property Value
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
Returns
GetHashCode()
public override int GetHashCode()
Returns
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 world-scoped voxel identity within this scan cell.
public IEnumerable<IVoxelOccupant> GetOccupantsFor(WorldVoxelIndex index)
Parameters
indexWorldVoxelIndexThe voxel identity including world and grid generations and its local index.
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 world-scoped voxel identity and occupant ticket.
public bool TryGetOccupantAt(WorldVoxelIndex index, OccupantTicket occupantTicket, out IVoxelOccupant? voxelOccupant)
Parameters
indexWorldVoxelIndexThe world-scoped identity of the voxel the occupant belongs to.
occupantTicketOccupantTicketThe unique ticket identifying the occupant.
voxelOccupantIVoxelOccupantThe retrieved occupant if found.
Returns
- bool
True if the occupant was found, otherwise false.