🧩 Health Core Interfaces¶
📦 Folder Overview¶
This folder defines the primary interaction surfaces for Health.
These are the interfaces most systems should depend on.
🎯 Purpose¶
Core interfaces provide:
- Safe, minimal access to health state and mutation
- A stable API surface for gameplay, UI, AI, and tooling
- A way to avoid depending on concrete implementations like
HealthSystem
🧩 What Lives Here¶
IHealthReadonly¶
Read-only view of health state.
Provides:
CurrentMaxNormalized01IsAlive,IsDeadIsFull,IsEmpty
Use for:
- UI (health bars, indicators)
- AI decision-making
- telemetry / analytics
- systems that only need to observe state
Notes:
- No mutation
- No dependency on damage/heal pipelines
- Safe to expose broadly
IHealthWriter¶
Controlled mutation surface.
Provides:
TryHeal(int)Heal(int)SetCurrent(int)SetMax(int, bool)ResetToMax()
Use for:
- setup / initialization
- save/load restore
- debugging / cheats
- controlled direct mutation flows
Important:
- Does not guarantee use of the damage/heal pipelines
- Behaviour (clamping, events, side-effects) depends on implementation
IHealable¶
Minimal healing interface.
Provides:
TryHeal(int)
Use for:
- lifesteal
- heal-over-time (HOT)
- generic support effects
Design intent:
- Smaller than
IHealthWriter - Suitable for systems that only need to apply healing
⚠️ Important Notes¶
- Prefer interfaces over
HealthSystemwhen sufficient - Do not assume mutation methods run through rule pipelines
- Do not encode gameplay rules into consumers of these interfaces
These are contracts, not behaviour definitions.
🧠 Usage Guidance¶
Prefer:
IHealthReadonlyfor most systemsIHealablefor simple healing effectsIHealthWriteronly when full mutation control is required
🔗 Related Documentation¶
- Health Abstractions
- Contracts
- Lifecycle
- Rules