🧠 Health — Unity Integration / Core¶
📦 Folder Overview¶
This folder contains the main Unity-facing runtime components for the Health system:
HealthSystemHealthConfigTeamProvider
They bridge abstract Health contracts into practical Unity behaviour.
🎯 Purpose¶
Provide the primary runtime implementation and authoring surfaces for Health in Unity.
🧩 What Lives Here¶
HealthSystem¶
Core runtime MonoBehaviour implementing:
IHealthReadonlyIHealthLifecycleIHealthWriterIDamageableIHealthMutator
Responsibilities:
- Damage and heal evaluation
- Death and revive flows
- Previews
- Current/max mutation
- Integration with rules, shields, authority, and handlers
HealthConfig¶
Optional ScriptableObject defaults for HealthSystem.
Used for:
- Default max health
- Initialisation behaviour
- Revive defaults
- Invincibility defaults
Notes:
- Configuration only
- Does not own runtime state
TeamProvider¶
Unity-facing implementation of ITeamProvider.
Provides:
- Inspector-authored
teamId
Notes:
- Data only
- No relationship or policy logic
⚠️ Important Notes¶
Runtime Responsibilities¶
Damage
- Guards (authority, dead, invincibility, locks)
- PRE rules
- Shields
- HP mutation
- POST observers
- Death flow
Healing
- Guards
- PRE rules
- Healing modifiers
- HP mutation
- POST observers
Lifecycle
- Revive and kill
- Direct mutation
- Snapshot and restore
- Preview APIs
Boundaries¶
Prefer depending on interfaces for gameplay code:
IHealthReadonlyIHealthWriterIHealthMutatorIDamageable
Use HealthSystem directly only when implementation features are required.
Component Roles¶
HealthSystem→ runtime implementationHealthConfig→ initial configurationTeamProvider→ identity data
🧠 Usage Guidance¶
- Treat this folder as the primary authoring surface in Unity
- Use abstractions to avoid unnecessary coupling
- Keep gameplay logic in rules and handlers
🚫 Not for Production Use¶
This folder is part of the runtime implementation and should not be extended via internal details.
🔗 Related Documentation¶
- Health Abstractions
- Rules
- Shields
- UI Connectors