![]() |
Mortar Pro Plugin
Version 2
Modular Turret Plugin
|
#include <MortarProHealthComponent.h>
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 |
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
UMortarProHealthComponent::UMortarProHealthComponent | ( | ) |
|
overrideprotectedvirtual |
Called when the game starts or when spawned
|
private |
Checks if the health is critical and calls a blueprint event if it gets low or stops critical Health event when health restores
float UMortarProHealthComponent::GetCriticalHealthPercentage | ( | ) | const |
Gets The Critical Health Percentage.This is the percentage beyond which the critical Health event will be called
float UMortarProHealthComponent::GetCriticalHealthThresholdPercentage | ( | ) | const |
Returns Critical Health Percentage.
int32 UMortarProHealthComponent::GetCurrentHealth | ( | ) | const |
Returns The Current Health of the ACtor
float UMortarProHealthComponent::GetHealthPercentage | ( | ) | const |
Returns Health Left Percentage.
int32 UMortarProHealthComponent::GetMaxHealth | ( | ) | const |
Getter function for Max Health
bool UMortarProHealthComponent::IsCriticalHealth | ( | ) | const |
Returns True if current health is below treshold of critical health,false otherwise
bool UMortarProHealthComponent::IsDead | ( | ) | const |
Checks if an actor is dead by checking the current Health
void UMortarProHealthComponent::ResetHealthRunTimeParameters | ( | ) |
Resets The Actor Health to the Default Health
void UMortarProHealthComponent::SetAvoidSameTeamDamage | ( | const bool & | bShouldAvoid | ) |
Sets whether to avoid same team or not
[in] | bShouldAvoid | true if want to avoid same team damage false otherwise |
void UMortarProHealthComponent::SetCriticalHealthPercentage | ( | const float & | Percentage | ) |
Sets The Critical Health Percentage.This is the percentage beyond which the critical Health event will be called
[in] | Percentage | Type Float This denotes the percentage at which the health is critical |
void UMortarProHealthComponent::SetCurrentHealth | ( | const int32 & | Health, |
bool | bEmitEvent = true |
||
) |
Sets The Current Health of the ACtor
[in] | Health | Current Health which is clamped to max Health |
[in] | bEmitEvent | true if want to emit events like health decreased/increased and critical health related events,false otherwse |
void UMortarProHealthComponent::SetMaxHealth | ( | const int32 & | Health | ) |
Sets The Maximum Health an actor can achieve
[in] | Health | Maximum Health |
bool UMortarProHealthComponent::ShouldAvoidSameTeamDamage | ( | ) | const |
Whether to avoid same team damage
|
protectedvirtual |
Function to afflict damage This will be called whener the owning actor Receives damage
[in] | DamagedActor | Actor which has been damaged |
[in] | Damage | Damage Amount |
[in] | DamageType | Type of Damage More Info on Epic Link |
[in] | InstigatedBy | Controller of the Instigator |
[in] | DamageCauser | Damage Causer Here In our example it will be Projectile Actor |
|
protected |
Whether to avoid same team damage
FMortarProBeginCriticalHealth UMortarProHealthComponent::BeginCriticalHealth |
Blueprint Event which is called when health drops beyond a critical threshold. Broadcasts Current Health
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.
FMortarProBeginDeath UMortarProHealthComponent::BeginDeath |
Blueprint Event which is called when Actor Dies
FMortarProBeginHealthDecreased UMortarProHealthComponent::BeginHealthDecreased |
Blueprint Event Whenever Health Decreases It Broadcasts Damage point along with it
FMortarProBeginHealthIncreased UMortarProHealthComponent::BeginHealthIncreased |
Blueprint Event Whenever Health Increases. It Broadcasts Healing point along with it
|
private |
Boolean Flag to check whether the event for critical Health is called
|
private |
Boolean Flag to check whether the event for Death is called
|
private |
This is the percentage beyond which the critical Health event will be called
|
private |
Critical Health Threshold Limit beyond which an event will be generated It will be CriticalHealthPercentage * MaxHealth
|
private |
Current Health of an Actor
|
private |
Default Health of an Actor
|
private |
Maximum Health of an Actor