Loading...
Searching...
No Matches
AdventureCore.IDamageSender Interface Reference

Detailed Description

interface for any behaviour that sends damage to a IDamageReceiver
check TriggerDamageReceiver and TriggerDamageSender for a common implementation that can in turn be built upon

Inheritance diagram for AdventureCore.IDamageSender:
AdventureCore.ICharacterAssociator AdventureCore.DamageEffect AdventureCore.SphereDamageSender AdventureCore.TriggerDamageSender AdventureCore.VisualScripting.DamageSenderUnit.UnitDamageSender AdventureSouls.SoulsCriticalAction AdventureCore.MovingDamageSender AdventureCore.ProjectileDamageSender

Public Member Functions

Vector3 GetPosition ()
 position of the receiver, may be used to determine damage direction
 
Vector3 GetDirection (IDamageReceiver receiver)
 calculates direction of damage between this sender and a receiver
 
bool PreDamage (IDamageReceiver receiver)
 called before any real damage handling to check if the handling is valid and should continue
for example if a character is currently dodging damage handling can be cancelled here
 
void OnDamage (DamageEvent e)
 this is where the main damage handling should take place and damage vectors are assigned
OnDamage is called in the order Sender > Receiver > Damage
for example if a character is wearing protective gear it may reduce the damage value here
this method is called for every damage parameter see DamageEvent for more details
 
void PostDamage (IDamageReceiver receiver, List< DamageEvent > events)
 called after alle the damages have been applied
this is a good spot to react to the change of state that has been done by the damages
for example death or destruction if health was reduced to 0 by the damages
 

Properties

IEnumerable< DamageParameterDamages [get]
 
- Properties inherited from AdventureCore.ICharacterAssociator
CharacterBase AssociatedCharacter [get]
 character that owns or is otherwise associted with the object
 

Member Function Documentation

◆ GetDirection()

Vector3 AdventureCore.IDamageSender.GetDirection ( IDamageReceiver receiver)

◆ GetPosition()

Vector3 AdventureCore.IDamageSender.GetPosition ( )

position of the receiver, may be used to determine damage direction

Returns
position of the receiver, or the character associated with it

Implemented in AdventureCore.DamageEffect, AdventureCore.SphereDamageSender, AdventureCore.TriggerDamageSender, AdventureCore.VisualScripting.DamageSenderUnit.UnitDamageSender, and AdventureSouls.SoulsCriticalAction.

◆ OnDamage()

void AdventureCore.IDamageSender.OnDamage ( DamageEvent e)

this is where the main damage handling should take place and damage vectors are assigned
OnDamage is called in the order Sender > Receiver > Damage
for example if a character is wearing protective gear it may reduce the damage value here
this method is called for every damage parameter see DamageEvent for more details

Parameters
e

Implemented in AdventureCore.DamageEffect, AdventureCore.SphereDamageSender, AdventureCore.TriggerDamageSender, AdventureCore.VisualScripting.DamageSenderUnit.UnitDamageSender, and AdventureSouls.SoulsCriticalAction.

◆ PostDamage()

void AdventureCore.IDamageSender.PostDamage ( IDamageReceiver receiver,
List< DamageEvent > events )

called after alle the damages have been applied
this is a good spot to react to the change of state that has been done by the damages
for example death or destruction if health was reduced to 0 by the damages

Parameters
sender
events

Implemented in AdventureCore.DamageEffect, AdventureCore.ProjectileDamageSender, AdventureCore.SphereDamageSender, AdventureCore.TriggerDamageSender, AdventureCore.VisualScripting.DamageSenderUnit.UnitDamageSender, and AdventureSouls.SoulsCriticalAction.

◆ PreDamage()

bool AdventureCore.IDamageSender.PreDamage ( IDamageReceiver receiver)

called before any real damage handling to check if the handling is valid and should continue
for example if a character is currently dodging damage handling can be cancelled here

Parameters
receiver
Returns
whether the damage handling should continue

Implemented in AdventureCore.DamageEffect, AdventureCore.ProjectileDamageSender, AdventureCore.SphereDamageSender, AdventureCore.TriggerDamageSender, AdventureCore.VisualScripting.DamageSenderUnit.UnitDamageSender, and AdventureSouls.SoulsCriticalAction.