PlayerHealthBar
Renders the player's current HP as a row of heart Toggle widgets. Subscribes to LevelManager events automatically at [DefaultExecutionOrder(10)].
Inspector Fields
| Field | Type | Description |
heartPrefab | Toggle | Toggle prefab instantiated once per maximum HP point. |
healthContainer | Transform | Parent transform that receives the spawned heart toggles. |
Methods
| Method | Description |
Initialize(LevelInfo level) | Clears existing hearts and spawns new ones based on the level's max HP. Called automatically on LevelManager.OnInitialize. |
InitializeContext(ExecutionContext context) | Subscribes to context.player.health.OnHealthUpdated for the current run. Called automatically on LevelManager.OnPlay. |
UpdateHealth(int value) | Toggles hearts on or off to reflect the current HP value. |
AddHearts(int value) | Spawns additional heart widgets at runtime (e.g. for HP bonuses). |
Reset(ExecutionContext context) | Sets all hearts back to full. Called automatically on LevelManager.OnReset. |
PlayerStaminaBar
Renders the player's current stamina as a row of pip Toggle widgets. Follows the same pattern and event subscription as PlayerHealthBar.
Inspector Fields
| Field | Type | Description |
pointPrefab | Toggle | Toggle prefab instantiated once per maximum stamina point. |
container | Transform | Parent transform that receives the spawned pip toggles. |
Methods
| Method | Description |
Initialize(LevelInfo level) | Clears existing pips and spawns new ones based on the level's max stamina. Called automatically on LevelManager.OnInitialize. |
InitializeContext(ExecutionContext context) | Subscribes to context.player.stamina.OnValueUpdated. Called automatically on LevelManager.OnPlay. |
UpdatePoints(int value) | Toggles pips on or off to reflect the current stamina value. |
AddPoints(int value) | Spawns additional pip widgets at runtime. |
Reset(ExecutionContext context) | Sets all pips back to full. Called automatically on LevelManager.OnReset. |
HUD_ShowStatEffectNumber
Displays a floating number above a character whenever damage, healing, or a block event fires. Add this component as a child of any GameObject that owns a Health or PlayerStamina component. It locates those components via GetComponentInParent in Start() — no Inspector wiring required.
Inspector Fields
| Field | Type | Description |
numberText | TMP_Text | Text element that displays the numeric value or the "Blocked" label. |
negativeColor | Color | Color applied to incoming damage numbers. Default: red. |
positiveColor | Color | Color applied to healing or stamina gain numbers. Default: blue. |
blockedColor | Color | Color applied when a "Blocked" label is shown. Default: green. |
Methods
| Method | Description |
ShowNumber(int number) | Sets the text to the given value, applies negativeColor for damage or positiveColor for healing, and triggers the pop-in animation. |
ShowBlockSign() | Sets the text to "Blocked", applies blockedColor, and triggers the animation. Called automatically on Health.OnDamageBlocked. |
Events subscribed
| Event | Response |
Health.OnDamageApplied | Calls ShowNumber(int) with the damage value. |
Health.OnDamageBlocked | Calls ShowBlockSign(). |
PlayerStamina.OnValueChanged | Calls ShowNumber(int) with the stamina delta. |