ReadonlyeventsUnit lifecycle and movement events. The same information the per-unit
onMoveStart / onCellEnter / onMoveEnd callbacks carry, but as a
broadcast: any number of subscribers, and no need to re-wire a callback
every time a unit is created.
unitManager.events.on('unitArrived', ({ unit, col, row }) => endTurn(unit, col, row));
Whether units on explored-but-not-currently-visible cells are hidden.
While enabled, this manager owns each unit Object3D's visible flag —
turn it off to drive visibility yourself.
True if the unit's cell is currently within some source's sight — i.e. whether it is drawn under the ghost-state rule. Always true when there is no fog data.
Registers a unit and adds its Object3D to the scene.
The unit's initial fog reveal is applied immediately if fogRevealRange > 0.
The unit's own onMoveStart / onCellEnter / onMoveEnd callbacks are
wrapped, not replaced — whatever you set stays wired, and removeUnit
puts the originals back, so a unit can be removed and re-added without
stacking a second layer of fog reveals on it.
Call once per frame with the elapsed time in seconds.
Updates all unit positions and syncs their Object3Ds — including the
ghost-state rule when hideUnitsInFog is on.
Clears and re-applies all unit fog contributions.
Call this after fogData.reset() — or after fogData.load() restores a
saved memory tier — to rebuild the live visibility tier from where the
units actually are.
Removes all units from the scene.
Manages a collection of HexUnits — updates their world positions each frame and syncs their attached Three.js Object3Ds.
Usage: