07 • Death FX Handlers¶
Purpose: Demonstrate how death-related visual and audio effects can be applied when a character dies. This includes handling death animations, visual effects, and sound effects.
🧩 What’s in this scene¶
- Player Character –
HealthSystemwith attached death and revive effects (animations, VFX, etc.). - Enemy Character –
HealthSystemwith similar death and revive effects applied. - Death FX Handlers – Scripts that trigger animations and effects when a character dies.
- Audio and Visual Effects – Includes VFX for death (e.g., explosions, fading effects) and audio for death sounds (e.g., a "death scream").
Components & Features¶
- DeathAnimationHandler: Triggers the appropriate death and revive animations when a character dies or is revived.
- HealthDeathEffectHandler: Applies any custom death effects like camera shake, particle effects, and other VFX when a character dies.
- Audio Effects: Plays a death sound effect upon the death of the character.
- Visual Effects: Includes a simple VFX handler to play effects like fading, explosion, or other custom effects when a character dies.
⚠️ Authority Note
This scene runs with Require Authority disabled by default.
Health mutations are allowed locally for demonstration purposes.Enabling an authority binder alone will not block mutations unless
Require Authority is enabled on the HealthSystem — this is intentional.Why Health works this way:
https://revandrab.github.io/RevFramework/authority/#health-opt-in-authority-gameplay-state
🕹️ How to use¶
- Press Play to start the scene.
- Damage the Player/Enemy to trigger death. Both player and enemy characters are set up to show the effects when their health drops to zero.
- Observe the Death Effects:
- Upon death, the DeathAnimationHandler triggers the "die" animation.
- HealthDeathEffectHandler plays configured VFX and audio.
- Revive the Character:
- Use the DebugUI to trigger a revive.
- Upon revive, the DeathAnimationHandler triggers the "revive" animation and resets any death effects.
⚙️ Key Components Used¶
| Component | Role |
|---|---|
| DeathAnimationHandler | Triggers death and revive animations through Unity’s Animator. |
| HealthDeathEffectHandler | Manages VFX (particles, camera shake, slow-time, etc.) and audio on death. |
| IHealthDeathEffectHandler | Interface for custom death effects. |
| AudioSource | Plays death/respawn audio. |
| HealthSystem | Core health/death integration. |
💡 Notes¶
- Death Effects: This scene demonstrates how to apply visual/audio effects upon death. Extend
HealthDeathEffectHandleror add your ownIHealthDeathEffectHandlerfor custom behaviour. - Animation Triggers:
DeathAnimationHandleruses Animator triggers (e.g., "Die", "Revive"). Ensure your Animator controller defines these. - Modular: The system is modular — swap out VFX, SFX, or animation handlers without touching
HealthSystem. - Audio: Audio is optional but recommended for immersion. A basic
AudioSourcewith a death sound effect is included.
🧩 Demo Notes¶
- The panel lets you preview and tweak handler settings (e.g., VFX offset, lifetime, shake intensity) at runtime.
This is for demo purposes — in production you’d configure values directly on prefabs.
🧱 Debug vs Production¶
- The IMGUI overlay + DebugUI are for debugging only.
- For shipped games, configure handlers on prefabs and trigger effects through your own gameplay systems.
⚙️ Key Interactions¶
| Interaction | Behaviour |
|---|---|
| Triggering Death | Apply damage to characters to observe death effects. |
| Triggering Revive | Use the DebugUI to revive the character and see revive effects. |
| Customizing Effects | Replace demo VFX/Audio handlers to match your game’s style. |
💡 Key Idea¶
Seamless Death Feedback: Modular handlers make it easy to integrate animations, sound, and VFX for death and revival, enhancing player feedback without tying logic to core health.