Class UniformGridSpatialIndex

Namespace
SurvivorsMaker.Simulation
Assembly
SurvivorsMaker.Simulation.dll

Reusable uniform grid. Candidates retain rebuild-time world order and identity.

public sealed class UniformGridSpatialIndex : ISpatialIndex
Inheritance
UniformGridSpatialIndex
Implements
Inherited Members

Constructors

UniformGridSpatialIndex(float)

public UniformGridSpatialIndex(float cellSize = 0)

Parameters

cellSize float

Zero selects a size from current enemy bounds, or arena density.

Properties

CellSize

public float CellSize { get; }

Property Value

float

Methods

QueryEnemies(Vec2, float, List<Enemy>)

Clears results, then adds living enemy candidates near radius of center.

public void QueryEnemies(Vec2 center, float radius, List<Enemy> results)

Parameters

center Vec2
radius float
results List<Enemy>

Rebuild(SimWorld)

public void Rebuild(SimWorld world)

Parameters

world SimWorld

Reserve(int)

Reserves the peak enemy budget before combat, including worst-case dense queries.

public void Reserve(int enemyCapacity)

Parameters

enemyCapacity int