Namespace TDMaker.Unity.Hud

Classes

CachedNumber

Caches the string for an integer so frequently updated labels do not allocate: the text of every value seen is kept (NumberText; with a prefix or suffix, per cache), so a value that comes back costs nothing.

CachedText

Caches the formatted text of a key with one integer (for example "Sell +{0}"), keeping the text of every number seen until the texts (Version: language, tables) change, so frequently updated labels do not allocate.

ClickPicking

Battlefield click-target rules used by GameHud (input grammar, spec 14 ยง1): every clickable thing has an axis-aligned world rectangle placed relative to its reference point; a click hits it only strictly inside (the border is excluded). Among the hits the higher selection priority wins, then the lower world reference point (smaller y). Equal priority and equal y keep the first candidate found.

DamageNumbers

Pooled floating damage and heal numbers (TextMesh Pro, outlined) on a screen-space canvas. Numbers are merged per target for a short window so rapid hits do not flood the screen; digits come from a cached string table and fading uses the canvas renderer alpha, so steady-state updates do not allocate. Toggle with damageNumbers.

GameHud

Production HUD for PC (mouse + keyboard), built in uGUI from code and styled by a HudTheme: top bar (gold, lives, wave, pause, speed), wave-call indicators at path entrances (countdown ring, early bonus), radial build menu, tower panel (upgrades, branches, abilities, target priority, rally, sell), hero portraits, spell bar with cooldowns and hotkeys, unit info, pause and victory/defeat screens, tooltips and world feedback (range ellipses, slot highlight, placement ghost, rally/move markers, spell aim). Interaction follows the input grammar of spec 14 (docs/specs/14-input-grammar.md): one selection or aiming state at a time; a battlefield left click acts at the release point; while a hero, rally point or spell is being aimed every battlefield click is a point attempt (valid: act and return to browsing; invalid: feedback and keep aiming); build, upgrade, branch, ability, sell and wave call are single clicks; right click cancels everything (and does nothing without a selection); Esc cancels a selection, otherwise opens/closes the pause menu. Failed or cancelled aims send no command and every result shown is read back from the simulation. Keys: Esc cancel/pause, Space/P pause, 1-9 spells, H hero, N next wave, F1 debug overlay. Text is TextMesh Pro; every string comes from Texts (keys in HudTexts), and the HUD relabels itself when the language or a table changes.

HudButton

A themed button built from code: background, optional icon, label, secondary label, cooldown shade and badge. Reports hover for tooltips and previews. Setters only touch components when a value changes.

HudSprites

Procedurally generated UI sprites used when a HudTheme slot is empty. All are white/grayscale so theme colours tint them. Panels and buttons are 9-sliced.

HudTheme

Look of the production HUD and of the world-space feedback (ranges, rally, aim). Every sprite slot is optional: empty slots use generated sprites from HudSprites. Create one with Assets/Create/2D Tower Defense Maker/HUD Theme and assign it to GameHud.

HudTheme.IconOverride

A HUD icon for one key.

HudUi

Small helpers that build themed uGUI elements from code.

LanguageSelector

Small native-language buttons for the sample title screens. Choices persist outside campaign slots.

NumberText

Shared strings for integers (0..TableSize-1 in a table, other values in a bounded map): each number is turned into a string once per session, so labels that show changing counts, timers or health do not allocate when a value comes back.

Enums

GameHud.Mode

Interaction state. Spell aiming is tracked separately (AimingSpell) and always runs in Browsing.