Mortar Pro Plugin  Version 2
Modular Turret Plugin
All Classes Namespaces Functions Variables Enumerations Enumerator Pages
UMortarProHealthComponent Class Reference

#include <MortarProHealthComponent.h>

+ Inheritance diagram for UMortarProHealthComponent:
+ Collaboration diagram for UMortarProHealthComponent:

Public Member Functions

float GetCriticalHealthPercentage () const
 
float GetCriticalHealthThresholdPercentage () const
 
int32 GetCurrentHealth () const
 
float GetHealthPercentage () const
 
int32 GetMaxHealth () const
 
bool IsCriticalHealth () const
 
bool IsDead () const
 
void ResetHealthRunTimeParameters ()
 
void SetAvoidSameTeamDamage (const bool &bShouldAvoid)
 
void SetCriticalHealthPercentage (const float &Percentage)
 
void SetCurrentHealth (const int32 &Health, bool bEmitEvent=true)
 
void SetMaxHealth (const int32 &Health)
 
bool ShouldAvoidSameTeamDamage () const
 
 UMortarProHealthComponent ()
 

Public Attributes

FMortarProBeginCriticalHealth BeginCriticalHealth
 
FMortarProBeginCriticalHealthRecovery BeginCrticalHealthRecover
 
FMortarProBeginDeath BeginDeath
 
FMortarProBeginHealthDecreased BeginHealthDecreased
 
FMortarProBeginHealthIncreased BeginHealthIncreased
 

Protected Member Functions

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

Protected Attributes

uint32 bAvoidSameTeamDamage: 1
 

Private Member Functions

void CheckCriticalHealth ()
 

Private Attributes

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

Detailed Description

This is a Generic Health ACtor Component which can be added to any character This allows additing health framework to any actor. It provides functionality like damage handling,setting crictical health and emits event when actor dies

Constructor & Destructor Documentation

◆ UMortarProHealthComponent()

UMortarProHealthComponent::UMortarProHealthComponent ( )

Member Function Documentation

◆ BeginPlay()

virtual void UMortarProHealthComponent::BeginPlay ( )
overrideprotectedvirtual

Called when the game starts or when spawned

◆ CheckCriticalHealth()

void UMortarProHealthComponent::CheckCriticalHealth ( )
private

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

◆ GetCriticalHealthPercentage()

float UMortarProHealthComponent::GetCriticalHealthPercentage ( ) const

Gets The Critical Health Percentage.This is the percentage beyond which the critical Health event will be called

Returns
percentage at which the health is critical in float

◆ GetCriticalHealthThresholdPercentage()

float UMortarProHealthComponent::GetCriticalHealthThresholdPercentage ( ) const

Returns Critical Health Percentage.

Returns
CriticalHealth Percentage in float

◆ GetCurrentHealth()

int32 UMortarProHealthComponent::GetCurrentHealth ( ) const

Returns The Current Health of the ACtor

Returns
Current Health which is clamped to max Health

◆ GetHealthPercentage()

float UMortarProHealthComponent::GetHealthPercentage ( ) const

Returns Health Left Percentage.

Returns
Health Percentage in float

◆ GetMaxHealth()

int32 UMortarProHealthComponent::GetMaxHealth ( ) const

Getter function for Max Health

Returns
Max Health of an actor

◆ IsCriticalHealth()

bool UMortarProHealthComponent::IsCriticalHealth ( ) const

Returns True if current health is below treshold of critical health,false otherwise

Returns
boolean value true/false

◆ IsDead()

bool UMortarProHealthComponent::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

◆ ResetHealthRunTimeParameters()

void UMortarProHealthComponent::ResetHealthRunTimeParameters ( )

Resets The Actor Health to the Default Health

◆ SetAvoidSameTeamDamage()

void UMortarProHealthComponent::SetAvoidSameTeamDamage ( const bool &  bShouldAvoid)

Sets whether to avoid same team or not

Parameters
[in]bShouldAvoidtrue if want to avoid same team damage false otherwise

◆ SetCriticalHealthPercentage()

void UMortarProHealthComponent::SetCriticalHealthPercentage ( const float &  Percentage)

Sets The Critical Health Percentage.This is the percentage beyond which the critical Health event will be called

Parameters
[in]PercentageType Float This denotes the percentage at which the health is critical

◆ SetCurrentHealth()

void UMortarProHealthComponent::SetCurrentHealth ( const int32 &  Health,
bool  bEmitEvent = true 
)

Sets The Current Health of the ACtor

Parameters
[in]HealthCurrent Health which is clamped to max Health
[in]bEmitEventtrue if want to emit events like health decreased/increased and critical health related events,false otherwse

◆ SetMaxHealth()

void UMortarProHealthComponent::SetMaxHealth ( const int32 &  Health)

Sets The Maximum Health an actor can achieve

Parameters
[in]HealthMaximum Health

◆ ShouldAvoidSameTeamDamage()

bool UMortarProHealthComponent::ShouldAvoidSameTeamDamage ( ) const

Whether to avoid same team damage

Returns
Max Health of an actor

◆ TakeDamage()

virtual void UMortarProHealthComponent::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

◆ bAvoidSameTeamDamage

uint32 UMortarProHealthComponent::bAvoidSameTeamDamage
protected

Whether to avoid same team damage

◆ BeginCriticalHealth

FMortarProBeginCriticalHealth UMortarProHealthComponent::BeginCriticalHealth

Blueprint Event which is called when health drops beyond a critical threshold. Broadcasts Current Health

◆ BeginCrticalHealthRecover

FMortarProBeginCriticalHealthRecovery UMortarProHealthComponent::BeginCrticalHealthRecover

Blueprint Event which is called when health restores and gets above a critical threshold. Broadcasts Current Health along with it as a payload.

◆ BeginDeath

FMortarProBeginDeath UMortarProHealthComponent::BeginDeath

Blueprint Event which is called when Actor Dies

◆ BeginHealthDecreased

FMortarProBeginHealthDecreased UMortarProHealthComponent::BeginHealthDecreased

Blueprint Event Whenever Health Decreases It Broadcasts Damage point along with it

◆ BeginHealthIncreased

FMortarProBeginHealthIncreased UMortarProHealthComponent::BeginHealthIncreased

Blueprint Event Whenever Health Increases. It Broadcasts Healing point along with it

◆ bIsCriticalHealthEventCalled

uint32 UMortarProHealthComponent::bIsCriticalHealthEventCalled
private

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

◆ bIsDeadEventCalled

uint32 UMortarProHealthComponent::bIsDeadEventCalled
private

Boolean Flag to check whether the event for Death is called

◆ CriticalHealthPercentage

float UMortarProHealthComponent::CriticalHealthPercentage = 25
private

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

◆ CriticalHealthThreshold

float UMortarProHealthComponent::CriticalHealthThreshold = 20
private

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

◆ CurrentHealth

int32 UMortarProHealthComponent::CurrentHealth = 100
private

Current Health of an Actor

◆ DefaultHealth

int32 UMortarProHealthComponent::DefaultHealth = 100
private

Default Health of an Actor

◆ MaxHealth

int32 UMortarProHealthComponent::MaxHealth = 100
private

Maximum Health of an Actor


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