Loading...
Searching...
No Matches
AdventureCore.SphereDamageSender Class Reference

Detailed Description

performs a sphere overlap and damages any IDamageReceiver on the colliders/rigidbodies it finds

https://adventure.softleitner.com/manual/damage

Inheritance diagram for AdventureCore.SphereDamageSender:
AdventureCore.IDamageSender AdventureCore.ICharacterAssociator

Public Member Functions

void Send ()
 
virtual Vector3 GetPosition ()
 position of the receiver, may be used to determine damage direction
 
virtual Vector3 GetDirection (IDamageReceiver receiver)
 calculates direction of damage between this sender and a receiver
 
virtual 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
 
virtual 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
 
virtual 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
 

Public Attributes

float Radius
 
LayerMask LayerMask
 
CharacterBase Character
 
DamageParameter[] Damages
 
TriggerDamageSender.DirectionMode Direction
 
float Magnitude = 0f
 
bool SendStart = true
 
bool SendUpdate = false
 
UnityEvent Damaged
 

Protected Member Functions

virtual void assignDamageVector (DamageEvent e)
 

Properties

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

Member Function Documentation

◆ GetDirection()

virtual Vector3 AdventureCore.SphereDamageSender.GetDirection ( IDamageReceiver receiver)
inlinevirtual

calculates direction of damage between this sender and a receiver

Parameters
receiver
Returns

Implements AdventureCore.IDamageSender.

◆ GetPosition()

virtual Vector3 AdventureCore.SphereDamageSender.GetPosition ( )
inlinevirtual

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

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

Implements AdventureCore.IDamageSender.

◆ OnDamage()

virtual void AdventureCore.SphereDamageSender.OnDamage ( DamageEvent e)
inlinevirtual

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

Implements AdventureCore.IDamageSender.

◆ PostDamage()

virtual void AdventureCore.SphereDamageSender.PostDamage ( IDamageReceiver receiver,
List< DamageEvent > events )
inlinevirtual

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

Implements AdventureCore.IDamageSender.

◆ PreDamage()

virtual bool AdventureCore.SphereDamageSender.PreDamage ( IDamageReceiver receiver)
inlinevirtual

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

Implements AdventureCore.IDamageSender.

Property Documentation

◆ AssociatedCharacter

CharacterBase AdventureCore.SphereDamageSender.AssociatedCharacter
get

character that owns or is otherwise associted with the object

Implements AdventureCore.ICharacterAssociator.