Namespace TDMaker.Unity.View

Classes

ArtSet

A swappable set of sprites keyed by view key (template view keys and projectile view keys). Assign one to an EntityViewRegistry to draw units, towers and projectiles with these sprites instead of the generated primitives; anything without an entry keeps its prefab or primitive look, so partial sets are fine. Swapping the asset swaps the whole look without code changes. Also carries the build plot sprite drawn by LevelView. Create one with Assets/Create/2D Tower Defense Maker/Art Set.

ArtSet.Entry

Sprites for one view key.

AudioCuePlayer

Plays AudioCues through a small pool of AudioSources and routes global game events (waves, building, selling, victory ...) and mechanic events (chains, traps, mines, beams, heals, shields, reflection, knockback, companions, returning units, body raising) to cues. Per-template cues (attack, hit, death, projectiles, spells) are routed by EntityViewRegistry; the HUD plays the interface cues (click, build menu, rally, wave call). Every slot is optional. Volumes come from TDGameSettings (Master × SFX or UI) and each channel may route to an AudioMixerGroup. Each cue respects its minInterval, at most Max Voices Per Cue copies play at once and the pool never grows past Voices (the oldest voice is reused), so dense fights do not stack sounds or allocate.

AudioCuePlayer.GlobalCues

Cues for global game events.

AudioCuePlayer.KeyedCue

A cue for one mechanic id (chain, trap, mine, beam, pulse, reflection, transfer or raise id), status effect id or template id (companions, returning units).

AudioCuePlayer.MechanicCues

Default cues for the built-in mechanic events. A AudioCuePlayer.KeyedCue with the mechanic's id overrides them.

EllipseRenderer

A smooth range ellipse: a filled mesh plus an outline line. Its shape always comes from RangeShape, the same ellipse the simulation uses for range checks, so what is drawn is what is hit.

EntityView

Pooled visual for one simulation entity: interpolated position, y-sorting, facing, optional health bar, hit flash, death fade, status-effect tint and icons, tower tier pips, projectile trail and orientation, hero death/return presentation, and an optional Animator driven with the standard parameters (Move bool, Speed float, Attack/Hit/Die triggers; missing parameters are skipped). Add it to custom prefabs to control sorting and the body renderer; it is added automatically otherwise.

EntityView.AnimatorParameters

Animator parameter names driven by the view.

EntityViewRegistry

Creates, pools and updates EntityViews from simulation events. Prefabs come from authoring assets or the TDMaker.Unity.View.EntityViewRegistry.overrides list (by view key); otherwise generated primitive sprites are used. Also routes per-template presentation hooks (VFX prefabs through VfxPool, audio cues through AudioCuePlayer) and draws built-in feedback: impact flashes, splash rings and instant-hit beams.

EntityViewRegistry.ViewOverride

Maps a view key to a prefab, overriding the asset's own prefab.

LevelView

Draws level geometry for samples and prototypes: a generated ground texture (grass, roads that follow the lanes, rocks, tufts and trees), path entry/exit markers and stone build pads. Everything is procedural and deterministic.

MusicPlayer

Plays background music: a menu loop while no battle is shown, the level's battle loop (music, falling back to this component's defaults), an optional intense loop from configurable waves (last wave, waves flagged bossWave, or from a wave number) and victory / defeat stingers that stop or duck the loop. Changes crossfade between two pooled AudioSources; a third plays stingers. Volume = track × TDGameSettings Music × Master, routed to the Music mixer group when one is set. No allocation per frame; every clip is optional (an empty slot is silent).

PointerInput

Mouse and keyboard access that works with both the Input System package and the legacy Input Manager.

PrimitiveSprites

Procedurally generated sprites (1 world unit across) so samples work with zero imported art. Every shape exists as a flat white silhouette and as an outlined, top-lit grayscale version; both are tinted by the renderer colour. Shapes are described by signed distance functions in unit space (-0.5..0.5, y up).

SimProfilerMarkers

Core profiling hook that wraps every fixed step and every pipeline stage (system) in a Unity Unity.Profiling.ProfilerMarker, so the Unity Profiler shows TDMaker.Sim.Step with one child marker per stage (TDMaker.Sim.Motion, TDMaker.Sim.Ranged, ...). Another ISimProfiler can be chained through Next; it receives every callback after the marker begins and before it ends.

SimulationRunner

Owns a Simulation and advances it with the core SimulationClock from Update (catch-up limit = catch-up ticks × speed per frame). Events produced during a frame are dispatched in emission order through EventRaised and then cleared, so the event buffer (Event Capacity) must hold every tick a frame catches up (at most catch-up ticks × speed). Commands queued after the game ended are rejected by the core with GameEnded on the next frame (the clock no longer steps, so the runner flushes them).

TDCameraController

Orthographic 2D camera for a level: frames the level on start using the level's CameraFramingData (fit the whole map, fit its height or width and scroll, or a fixed view size; start focus and optional intro pan) at any aspect ratio, and optionally pans (screen edge, middle-mouse drag, WASD/arrows, left drag from empty ground) and zooms (mouse wheel, +/-), always clamped to the bounds. Toggles live in TDGameSettings.

TDGameSettings

Player-facing presentation toggles read by the camera, HUD and feedback components. Put one in the scene (components find it automatically) and expose its fields in your options menu.

TDHud

Minimal IMGUI heads-up display for PC (mouse and keyboard): economy and wave status, wave calling, speed control, slot/tower menus (build, branching upgrades, abilities, target priority, sell, rally), hero portraits with level/XP/skills/respawn timer and click-to-move, and spell buttons with click-to-target. Every range, aim and pick ellipse uses RangeShape, the same shape as the simulation's range check.

UpgradeRunRecord

The permanent upgrades of one run: the shop's name, the purchased rank of every track and the forced rank (-1 = none). Saved next to a recorded command log (<file>.upgrades.json) so a replay rebuilds the same snapshot.

VfxPool

Pools VFX prefab instances. Particle systems on an instance are restarted on reuse and the instance returns to the pool after its lifetime (particle duration + start lifetime, or TDMaker.Unity.View.VfxPool.defaultLifetime).

Interfaces

IPooledVfx

Implement on a VFX prefab's components to be told when a pooled instance is (re)used.

Enums

GroundStyle

How LevelView draws the ground.

MusicPlayer.State

What the player is currently playing.

MusicPlayer.StingerMode

What a victory or defeat stinger does to the battle loop.

TDKey

Keyboard keys used by the default PC controls.

Delegates

SimEventHandler

Receives simulation events without copying them.

TemplateDecorator

Changes a baked template before the simulation is created (for example to add WithCustomData values). asset is the authoring asset the template came from, or null. Return the template to use.