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 positionBodyPartType
( optional ): theEBodyPartType
receiving the hitHitSource
( optional ):EHitSource
of the hit, adds semantic informationIsCritical
( optional ):IsFriendlyFire
: automatically set byRecalculateSourceHit()
in theHitSystem
after callingISignalHit
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:
ISignalHit()
:HitData
is processed andHealthData
is modified.ISignalModifyHealthNoReport()
: ReceivedHealthData
as a ref and proceeds with processing it. TheHealth
component's properties are updated according to the information provided byHealthData
. The final results of this operation are saved back toHealthData
.ISignalOnHit()
and its counter-part eventHit
are called.HealthSystem.ReportHealthModified()
is called.- Step 4. triggers a Signal-Event pair based on the
EHealthAction
in theHealthData
:ISignalOnHeal()
andHeal()
ISignalOnDamage
andDamage()
ISignalOnRevive()
andRevive()
ISignalOnDeath()
andDeath()
The events triggered in the last step are executed at the end of the frame.
Back to top