This document is about: QUANTUM 2
SWITCH TO

Hits

Overview

The HitSystem extends the HealthSystem with supporting attributes, friendly fire and body part damage multipliers. The HitSystem is in charge of all hit, damage and healing calculations. The HitSystem relies on the HealthSystem and uses its API to apply changes to the Health component based on the hit calculations.

N.B.: This system is part of the FPS folder and is designed to rewriten according to your specific game design's needs.

HitData

HitData contains the information related to the hit itself and is an argument required by the ISignalHit parameter for calculating the output of the hit. The HitData is made of the following fields:

  • Target ( required ): the Entity which is hit (e.g. an enemy Agent)
  • Source ( required ): the Entity which generated the hit (e.g. a Projectile)
  • Instigator ( required ): the Entity which instigated the hit (e.g. an Agent - owner of Weapon and the Projectile causing the hit)
  • Position ( required ): Hit position
  • BodyPartType ( optional ): the EBodyPartType receiving the hit
  • HitSource ( optional ): EHitSource of the hit, adds semantic information
  • IsCritical ( optional ):
  • IsFriendlyFire: automatically set by RecalculateSourceHit() in the HitSystem after calling ISignalHit

All fields marked as required need to have a value assigned prior to passing the HitData to ISignalHit.

ISignalHit

ISignalHit is the recommended path to doing any hit, damage or healing calculations that have an effect on the Health component; avoid calling ISignalModifyHealth from the HealthSystem directly.

To proceed with its calculations, ISignalHit requires a valid pair of HitData and HealthData structs - the latter is described on the HealthSystem page.

When using ISignalHit, the following signals and events will be fired in order:

  1. ISignalHit(): HitData is processed and HealthData is modified.
  2. ISignalModifyHealthNoReport(): Received HealthData as a ref and proceeds with processing it. The Health component's properties are updated according to the information provided by HealthData. The final results of this operation are saved back to HealthData.
  3. ISignalOnHit() and its counter-part event Hit are called.
  4. HealthSystem.ReportHealthModified() is called.
  5. Step 4. triggers a Signal-Event pair based on the EHealthAction in the HealthData:
    • ISignalOnHeal() and Heal()
    • ISignalOnDamage and Damage()
    • ISignalOnRevive() and Revive()
    • ISignalOnDeath() and Death()

The events triggered in the last step are executed at the end of the frame.

Back to top