UI > Views > Game Board View

Owns all visual representation of the game board. Manages terrain and entity rendering, ghost overlay, tile highlights, pathfinding display, and pointer event translation. Drives BoardGhostSystem, BoardHighlightSystem, and BoardVfxSystem in response to scene events and engine effects.

init

Draws the board, populates initial entities, and wires up pointer listeners.

#drawBg

Draws the inset panel background behind the board.

#drawBoard

Creates the rexBoard hex grid and populates it with TerrainObject tiles.

#drawEntities

Renders all entities present at game start.

#setupListeners

Wires up rexBoard pointer events and maps them to internal handlers.

rexBoard event quirks to be aware of:

Implementation notes:

#onTileLeftDown

Emits a POINTER_LEFT_DOWN event with the tile coordinates.

#onTileRightDown

Emits a POINTER_RIGHT_DOWN event with the tile coordinates.

#onTileOver

Moves the ghost to the hovered tile and updates the path display if a pathfinder is active.

#onTileOut

Fires on tile exit. Reserved for future per-tile hover-out logic.

#onBoardOver

Marks the pointer as on the board and shows the ghost if no pathfinder is active.

#onBoardOut

Marks the pointer as off the board, hides the ghost, and clears any active path.

#getObjectAt

Returns the EntityObject chess piece at the given tile position, or null if nothing is there. All entities share the unit layer for chess lookups.

#getTerrainAt

Returns the TerrainObject at the given tile coordinates, or null for off-board positions. Used as the primary existence check before handling any tile event, since some positions on the hex grid are intentionally empty.

renderEntity

Render the given entity on to the board as a "chess" piece.

moveEntity

Tweens the entity's visual from its current board position to the new tile. Updates rexBoard tracking to the destination before animating so subsequent lookups use the correct position immediately.

attackEntity

Plays the attack animation between two entities.

updateEntityHealth

Updates the entity's health bar and queues a floating text notification. Negative amount shows a damage label, positive shows a regen label.

removeEntity

Plays the death animation then removes the entity from the board and destroys its game object.

addEntityStatus

Attaches the particle effect for the given status to the entity's game object.

removeEntityStatus

Removes the particle effect for the given status from the entity's game object.

setGhost

Switches the active ghost mode and immediately triggers a toggle to re-snap it into position at the current pointer location.

toggleGhost

Shows the ghost if the pointer is on the board, then re-emits tileover at the current pointer position over a short interval. This ensures the ghost snaps into place without requiring a manual hover out/over, and the interval smooths the transition when toggling during the right-click cancel race condition.

Public so PlayScene can call it directly to re-establish the ghost after a menu overlay or other UI state that may have hidden or replaced it.

addHighlights

Converts TileData to TerrainObjects and applies the highlight set.

removeHighlights

Clears all highlights of the given type.

activatePathfinder

Activates the pathfinder for the given entity with the available move points.

deactivatePathfinder

Deactivates and destroys the current pathfinder, clearing any displayed path.




© Gamesanova 2026