Skip to content

04_RegenIFramesCombat — Regen • I-Frames • Combat

Goal

Teach how regeneration, invincibility frames, and combat state work as optional handler components around a HealthSystem target.

What This Scene Demonstrates

HealthSystem target → optional handler component → public handler action → event/result feedback.

This scene shows how support handlers layer behaviour around the core HealthSystem without owning health state themselves. Damage still goes through HealthSystem.ApplyDamage, healing still goes through HealthSystem.TryHeal, and handler state comes from the real handler components.

The panel displays events and state. It does not fake i-frame, regen, combat, damage, or healing behaviour.

What To Look For

  • Setup: The panel binds a target with HealthSystem and detects optional handler components.
  • Quick Actions: Damage, Heal, Kill, and Revive drive real HealthSystem paths.
  • I-Frames: The invincibility handler owns active/inactive state and remaining time.
  • Regen: The regeneration handler owns cooldown, active state, smooth/ticked mode, and optional ceiling.
  • Combat: The combat-state component owns in-combat state and remaining out-of-combat timer.
  • Feedback: Damage attempts, i-frame events, regen state, and combat state are reported through visible panel feedback.

Mental model: target HealthSystem → optional handler → public action → service/handler result → visible state update.

Sample Scope

This scene covers:

  • HealthSystem damage and healing actions
  • HealthInvincibilityHandler activation and remaining time
  • I-frame start/end event feedback
  • HealthRegenerationHandler enable/disable state
  • Regen delay, amount, interval, and smooth mode
  • Optional regen ceiling modes
  • Regen cooldown and active-state display
  • HealthCombatState mark/exit controls
  • Combat timer display
  • Kill and Revive test actions

This scene does NOT cover:

  • Damage rules in detail
  • Shield behaviour in detail
  • Full death FX handling
  • Networking implementation
  • Production combat input
  • Production HUD/VFX/audio integration

Missing handlers simply disable their matching sections. They are optional components, not mandatory HealthSystem dependencies.

Authority Note

This scene may include a permissive sample authority setup where mutations are allowed locally for demonstration purposes.

Networking Reminder

No networking is included; integration is the developer’s responsibility.

How To Use

  1. Enter Play Mode.
  2. Open the Setup tab.
  3. Confirm the panel has:

  4. a Target binding

  5. optional Attacker binding
  6. HealthSystem on the target
  7. optional HealthInvincibilityHandler
  8. optional HealthRegenerationHandler
  9. optional HealthCombatState
  10. Use the health bar to inspect current HP.
  11. Use Damage to send a real DamageContext through HealthSystem.ApplyDamage.
  12. Use Heal to call HealthSystem.TryHeal.
  13. Use Kill to force the target into a dead state.
  14. Use Revive to restore the target.
  15. Open the I-Frames tab.
  16. Click Activate to start invincibility.
  17. Return to Setup and apply damage while i-frames are active.
  18. Confirm the hit is rejected by the HealthSystem while invincibility is active.
  19. Open the Regen tab.
  20. Toggle Enable and Smooth as needed.
  21. Configure:

  22. Delay

  23. Amount
  24. Interval

  25. Click Apply to apply regen settings and restart cooldown.

  26. Configure the optional regen ceiling:

  27. % of Max

  28. % Above Activation
  29. Absolute (HP)

  30. Use the cooldown and ceiling bars to inspect waiting, active, preview, and live target state.

  31. Open the Combat tab.
  32. Click Mark Now to enter combat and refresh the timer.
  33. Click Force Exit to clear combat state immediately.
  34. Watch the combat timer count down against OutOfCombatDelay.

Failure Behaviour

  • Missing Target

  • Meaning: The panel has no health object to inspect or mutate.

  • Fix: Assign a GameObject with HealthSystem.

  • Missing HealthSystem

  • Meaning: The selected target cannot run this panel.

  • Fix: Add HealthSystem or choose a valid health target.

  • Optional Handlers Missing

  • Meaning: One or more handler sections cannot run.

  • Fix: Add HealthInvincibilityHandler, HealthRegenerationHandler, or HealthCombatState to test those behaviours.

  • I-Frames Blocked

  • Meaning: I-frame debugging needs a target with HealthSystem.

  • Fix: Return to Setup and assign a valid target.

  • Missing HealthInvincibilityHandler

  • Meaning: The target cannot activate i-frames from this panel.

  • Fix: Add HealthInvincibilityHandler to the target.

  • Regen Blocked

  • Meaning: Regen debugging needs a target with HealthSystem.

  • Fix: Return to Setup and assign a valid target.

  • Missing HealthRegenerationHandler

  • Meaning: Regen tuning and cooldown display are unavailable.

  • Fix: Add HealthRegenerationHandler to the target.

  • Combat Blocked

  • Meaning: Combat debugging needs a target with HealthSystem.

  • Fix: Return to Setup and assign a valid target.

  • Missing HealthCombatState

  • Meaning: Combat timer controls are unavailable.

  • Fix: Add HealthCombatState to the target.

  • No damage applied: missing HealthSystem

  • Meaning: Damage has no valid service target.

  • Fix: Assign a valid target in Setup.

  • No damage applied: amount must be greater than 0

  • Meaning: Damage value is zero or invalid.

  • Fix: Increase Damage value.

  • Target is dead

  • Meaning: Damage is rejected while the target is dead.

  • Fix: Revive before applying damage.

  • No heal applied: missing HealthSystem

  • Meaning: Healing has no valid service target.

  • Fix: Assign a valid target in Setup.

  • No heal applied: amount must be greater than 0

  • Meaning: Heal value is zero or invalid.

  • Fix: Increase Heal value.

  • Heal had no effect

  • Meaning: HealthSystem.TryHeal returned false.

  • Fix: Check whether the target is full, dead, locked, or blocked by health rules.

  • AuthorityBlocked

  • Meaning: Damage was blocked by authority policy.

  • Fix: Check health authority settings or run from an allowed authority path.

  • Invincible

  • Meaning: Damage was blocked by active i-frames.

  • Fix: Wait for i-frames to end or avoid the invincibility source.

  • DamageLocked

  • Meaning: Damage is currently locked.

  • Fix: Unlock damage or inspect the component that locked it.

  • AbsorbedByShield

  • Meaning: Damage was fully absorbed by a shield.

  • Fix: Deplete/bypass the shield or increase damage.

  • ZeroOrNegativeAmount

  • Meaning: Damage was reduced to zero by active rules or shields.

  • Fix: Increase damage or inspect active rules/shields.

Behind The Scenes

  • HealthSystem — owns current HP, max HP, damage, healing, kill, and revive paths
  • DamageContext — created for damage actions
  • DamageTag.Melee — used by the panel’s quick damage action
  • HealthSystem.ApplyDamage(in ctx) — authoritative damage mutation path
  • HealthSystem.TryHeal(amount) — authoritative healing path
  • HealthSystem.Kill() — forces dead state for testing
  • HealthSystem.Revive() — restores from dead state for testing
  • HealthInvincibilityHandler — owns i-frame activation, remaining time, and start/end events
  • HealthRegenerationHandler — owns regen enable state, delay, amount, interval, smooth mode, cooldown, and ceiling
  • HealthCombatState — owns in-combat state, out-of-combat delay, and remaining combat time
  • DamageResult — reports damage attempt outcome and rejection reason
  • HealthReasonText.ToUi(reason) — maps rejection reasons to UI-facing explanations

The panel uses public HealthSystem and handler APIs only. It does not access internals, use reflection, or bypass service results.

Key Takeaway

I-frames, regeneration, and combat state are separate optional behaviours around the HealthSystem.

The handlers own their own state, while HealthSystem remains the source of truth for health mutation.

That keeps the behaviour modular, observable, and easy to test without cramming every combat concern into the core health component.