Health
Overview
The HealthSystem
is a SystemSignalsOnly
system which provides a way to damage, heal and kill entities. The point of entry is ISignalModifyHealth
and requires a HealthData
struct.
By default, the HealthSystem
does not take external conditions such as attributes or friendly fire into consideration, nor does it return a modified HealthData
for further usage. This limitation is, to a degree, mitigated by the HitSystem
which provides a customizable environment to calculate hits.
ISignalModifyHealthNoReport
is an avenue provided by the HealthSystem
to modify the HealthData
. In this case, HealthData
is passed as a reference thus enabling further processing after a first heatlh pass. Passing HealthData
as a reference ensures the properties inside the structure have been calculated when execution control is returned to the calling method. However, this means HealthSystem.ReportHealthModified()
needs to be manually invoked with the final HealthData
after the processing is done.
The Health
component itself supports IsInvulnerable
and IsRevivable
; these can be set at any time.
HealthData
The HealthData
contains the following properties:
Type
( required ): theEHealthType
defining what is affected - Health / Shield / Health and ShieldAction
( required ): theEHealthAction
definining what action is to be taken - Add / Remove / Remove All / Kill / ReviveResult
( automatic ): theEHealthActionResult
- None / Applied / IgnoredTarget
( required ): the Entity whose health is modifiedSource
( required ): the Entity which created the modify request (e.g. a Projectile)Instigator
( required ): the Entity which instigated the health change (e.g. an Agent - the owner of the Weapon / the Projectile causing the change)DesiredAmount
( required ): Desired valueAppliedAmount
( automatic ): Applied value, reflects the real change based on the internal component stateIgnoreMax
: If set totrue
, theHealth
/Shield
properties can go over their maximum limitsHasDied
( automatic ): Indicates the entity has diedHasRevived
( automatic ): Indicates the entity has been revivedWasDamaged
( automatic ): Indicates the entity was damagedWasHealed
( automatic ): Indicates the entity was healed
Note: All fields marked as required need to have a value assigned prior to passing the HealthData
to ISignalHit
. All fields marked as automatic are set automatically insideISignalModifyHealth
.
ReportHealthModified
HealthSystem.ReportHealthModified()
is used to report to the changes made to the Health
component. This can be called after ISignalModifyHealthNoReport
.
N.B.: ISignalModifyHealth
should not be called directly, use the HitSystem
instead.
The HealthSystem
supports these signal-event pairs for reporting changes :
ISignalOnHeal
andHeal
ISignalOnDamage
andDamage
ISignalOnDeath
andDeath
(synced event)ISignalOnRevive
andRevive
(synced event)