Modular Turret C++ Plugin  Version 3
Turret C++ Unreal engine 4 plugin
UMortarHealthComponent Class Reference
+ Inheritance diagram for UMortarHealthComponent:
+ Collaboration diagram for UMortarHealthComponent:

Public Member Functions

void CheckIsCriticalHealth ()
 
float GetCriticalHealthThresholdPercentage () const
 
int32 GetDefaultHealth () const
 
int32 GetHealth () const
 
float GetHealthPercentage () const
 
int32 GetMaxHealth () const
 
bool IsDead () const
 
void ResetHealth ()
 
void SetCurrentHealth (const int32 &Health)
 
void SetDefaultHealth (const int32 &Health)
 
void SetMaxHealth (const int32 &Health)
 
 UMortarHealthComponent ()
 

Public Attributes

FMortarDeadEvent ActorDeadEvent
 
FMortarCriticalHealthEvent CriticalHealthEvent
 
FMortarCriticalHealthRecoverEvent CrticalHealthRecoverEvent
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void TakeDamage (AActor *DamagedActor, float Damage, const class UDamageType *DamageType, class AController *InstigatedBy, AActor *DamageCauser)
 

Private Attributes

uint32 bIsCriticalHealthEventCalled: 1
 
uint32 bIsDeadEventCalled: 1
 
float CriticalHealthPercentage = 25
 
float CriticalHealthThreshold = 20
 
int32 CurrentHealth = 100
 
int32 DefaultHealth = 100
 
int32 MaxHealth = 100
 

Constructor & Destructor Documentation

◆ UMortarHealthComponent()

UMortarHealthComponent::UMortarHealthComponent ( )

Member Function Documentation

◆ BeginPlay()

virtual void UMortarHealthComponent::BeginPlay ( )
overrideprotectedvirtual

Called when the game starts or when spawned

◆ CheckIsCriticalHealth()

void UMortarHealthComponent::CheckIsCriticalHealth ( )

Checks if the health is critical and calls a blueprint event if it gets low or stops critical Health event when health restores

◆ GetCriticalHealthThresholdPercentage()

float UMortarHealthComponent::GetCriticalHealthThresholdPercentage ( ) const

Returns Critical Health Percentage.

Returns
CriticalHealth Percentage in float

◆ GetDefaultHealth()

int32 UMortarHealthComponent::GetDefaultHealth ( ) const

Getter function for Default Health

Returns
Default Health of an actor

◆ GetHealth()

int32 UMortarHealthComponent::GetHealth ( ) const

Returns The Current Health of the ACtor

Returns
Current Health which is clamped to max Health

◆ GetHealthPercentage()

float UMortarHealthComponent::GetHealthPercentage ( ) const

Returns Health Left Percentage.

Returns
Health Percentage in float

◆ GetMaxHealth()

int32 UMortarHealthComponent::GetMaxHealth ( ) const

Getter function for Max Health

Returns
[in] Max Health of an actor

◆ IsDead()

bool UMortarHealthComponent::IsDead ( ) const

Checks if an actor is dead by checking the current Health

Returns
Returns True if Current Health less than and equal to 0, false otherwise

◆ ResetHealth()

void UMortarHealthComponent::ResetHealth ( )

Resets The Actor Health to the Default Health

◆ SetCurrentHealth()

void UMortarHealthComponent::SetCurrentHealth ( const int32 &  Health)

Sets The Current Health of the ACtor

Parameters
[in]HealthCurrent Health which is clamped to max Health

◆ SetDefaultHealth()

void UMortarHealthComponent::SetDefaultHealth ( const int32 &  Health)

Sets The Default Health an actor This will also be clamped to MaxHealth

Parameters
[in]HealthDefault Health of an actor

◆ SetMaxHealth()

void UMortarHealthComponent::SetMaxHealth ( const int32 &  Health)

Sets The Maximum Health an actor can achieve

Parameters
[in]HealthMaximum Health

◆ TakeDamage()

virtual void UMortarHealthComponent::TakeDamage ( AActor *  DamagedActor,
float  Damage,
const class UDamageType *  DamageType,
class AController *  InstigatedBy,
AActor *  DamageCauser 
)
protectedvirtual

Function to afflict damage This will be called whener the owning actor Receives damage

Parameters
[in]DamagedActorActor which has been damaged
[in]DamageDamage Amount
[in]DamageTypeType of Damage More Info on Epic Link
See also
https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/UDamageType/index.html
Parameters
[in]InstigatedByController of the Instigator
[in]DamageCauserDamage Causer Here In our example it will be Projectile Actor

Member Data Documentation

◆ ActorDeadEvent

FMortarDeadEvent UMortarHealthComponent::ActorDeadEvent

Blueprint Event which is called when Actor Dies

◆ bIsCriticalHealthEventCalled

uint32 UMortarHealthComponent::bIsCriticalHealthEventCalled
private

Boolean Flag to check whether the event for critical Health is called

◆ bIsDeadEventCalled

uint32 UMortarHealthComponent::bIsDeadEventCalled
private

Boolean Flag to check whether the event for Death is called

◆ CriticalHealthEvent

FMortarCriticalHealthEvent UMortarHealthComponent::CriticalHealthEvent

Blueprint Event which is called when health drops beyond a critical threshold

◆ CriticalHealthPercentage

float UMortarHealthComponent::CriticalHealthPercentage = 25
private

This is the percentage beyond which the critical Health event will be called

◆ CriticalHealthThreshold

float UMortarHealthComponent::CriticalHealthThreshold = 20
private

Critical Health Threshold Limit beyond which an event will be generated It will be CriticalHealthPercentage * MaxHealth

◆ CrticalHealthRecoverEvent

FMortarCriticalHealthRecoverEvent UMortarHealthComponent::CrticalHealthRecoverEvent

Blueprint Event which is called when health restores and gets above a critical threshold

◆ CurrentHealth

int32 UMortarHealthComponent::CurrentHealth = 100
private

Current Health of an Actor

◆ DefaultHealth

int32 UMortarHealthComponent::DefaultHealth = 100
private

Default Health of an Actor

◆ MaxHealth

int32 UMortarHealthComponent::MaxHealth = 100
private

Maximum Health of an Actor


The documentation for this class was generated from the following file: