PYRAMID — Tower Defense
README.md
BuildCursor
The Keeper's hand. There is no player body: the player builds by pointing at the causeway.
What it does
- Casts a ray from the pointer (
Physics.raycastScreen) and reads which of the ten plinths it hit — the plinth's ownBoxCollider, or the click body of a tower raised on it. - Shows a see-through preview of
State.selectedon the free plinth and a ring of ground showing the tower's reach: turquoise when the pyramid can pay, blood red when it cannot. Over a tower that already stands the ring turns gold and shows that tower's actual reach. - Raises the tower on a left click, paying
rules.TOWERS[kind].costthroughState.spend— the spend is the refusal, and a refused click flashes the ring red and places nothing. - Raises a standing tower one level when the player clicks it instead.
- Ignores the pointer while the HUD has it (
uiWantsPointer/uiTookPress), and only builds in thebuildandwavephases.
Attaches to
The scene's empty BuildCursor entity (the entrypoint hangs it there at play
start). Towers it raises are parented to it, so a scene unload takes them along.
Sibling components
Tower — the preview is a Tower with ghost = true, so the ghost is exactly
the tower that will be placed, geometry and all. It reads pyramid.state for
the phase, the stone, the selection and the plinths that are already taken.
Fields
| field | meaning |
|---|---|
armed | whether pointing at the causeway can raise a tower right now |