❤️ Health — UI Connectors¶
This folder contains optional UI binding components for the Health system.
These connectors map health data to Unity UI without affecting gameplay.
🎯 Purpose¶
UI connectors exist to:
- Bind health state to UI elements
- Provide quick drop-in visualisation
- Remain completely decoupled from gameplay logic
📏 Design Principles¶
- Interface-driven (
IHealthReadonly) - No dependency on
HealthSysteminternals - No mutation of health state
- Safe to remove or replace
- No gameplay logic embedded
- Poll-based updates (no required events)
📂 Components¶
🧩 HealthBarUIConnector¶
Binds Image.fillAmount to health percentage.
Resolution Order¶
- Explicit
healthTarget - Local search (self → parent → children)
- Throttled scene-wide search
Behaviour¶
- Uses
IHealthReadonly - Updates in
UpdateorLateUpdate - Auto-configures
Imagefill settings - Displays
0%if no target found - Optional debug logging
🌍 WorldSpaceHealthBar¶
World-space UI health bar.
Features¶
- Camera-facing billboard
- Distance-based scaling (optional)
- Gradient colouring (optional)
- Hide when full (optional)
- Throttled scene search fallback
Behaviour¶
- Uses
IHealthReadonly - Updates in
LateUpdate - No event subscriptions
- No mutation of health
⚠️ What This Layer Does NOT Do¶
- Does NOT modify HP
- Does NOT influence damage/heal calculations
- Does NOT run rules
- Does NOT require authority
- Does NOT replicate state
- Does NOT assume networking model
🔄 Integration Model¶
UI should depend on:
IHealthReadonly- Optional events (
Damaged,Healed,HealthChanged,MaxChanged)
Never bind directly to internal fields.
🧠 Mental Model¶
- HealthSystem → owns state
- Rules → shape behaviour
- UI → reads and displays
UI is read-only.
🔗 See Also¶
- Health Overview
- Rules
- Shields
- Health System