Space Plunder
Loading...
Searching...
No Matches
UHealthWidget Class Reference

#include <HealthWidget.h>

Inheritance diagram for UHealthWidget:

Public Member Functions

 UHealthWidget (const FObjectInitializer &ObjectInitializer)
 
void SetHasShield (const bool in_bHasShield)
 
void UpdateHealth (const float CurrentHealth, const float MaxHealth, const class UDamageType *DamageType)
 
void UpdateHealthAndShield (const float CurrentHealth, const float MaxHealth, const float CurrentShieldHealth, const float MaxShieldHealth, const class UDamageType *DamageType=nullptr)
 
void ShieldBroken ()
 
void InjuredBodyPart (EBodyPartName InjuredBodyPart, FVector HitLocation, const TArray< FBodyPart > &AllBodyParts)
 

Public Attributes

FVector2D SpacerSize = FVector2D(0.0f, 4.0f)
 
FVector2D BarSize
 
FProgressBarStyle HealthStyle
 
FProgressBarStyle ShieldStyle
 
FProgressBarStyle ShieldDamageStyle
 
FProgressBarStyle HealthDamageStyle
 

Protected Member Functions

virtual bool Initialize () override
 
virtual void NativePreConstruct () override
 
virtual void NativeConstruct () override
 

Protected Attributes

class UProgressBar * HealthBar
 
class UProgressBar * ShieldBar
 
class UOverlay * ShieldOverlay
 
class UOverlay * HealthOverlay
 
class USpacer * Spacer
 

Private Attributes

bool bHasShield = false
 

Constructor & Destructor Documentation

◆ UHealthWidget()

UHealthWidget::UHealthWidget ( const FObjectInitializer & ObjectInitializer)
explicit
10 :Super(ObjectInitializer)
11{
12 // HealthStyle;
13 // ShieldStyle;
14 // ShieldDamageStyle;
15 // HealthDamageStyle;
16
17}

Member Function Documentation

◆ Initialize()

bool UHealthWidget::Initialize ( )
overrideprotectedvirtual
20{
21 const bool Success = Super::Initialize();
22 if(!Success) return false;
23 if (!ensure(HealthBar != nullptr)) return false;
24 if (!ensure(ShieldBar != nullptr)) return false;
25 if (!ensure(ShieldOverlay != nullptr)) return false;
26 if (!ensure(HealthOverlay != nullptr)) return false;
27 if (!ensure(Spacer != nullptr)) return false;
28 return true;
29}
class UOverlay * HealthOverlay
Definition HealthWidget.h:60
class UProgressBar * ShieldBar
Definition HealthWidget.h:56
class USpacer * Spacer
Definition HealthWidget.h:62
class UProgressBar * HealthBar
Definition HealthWidget.h:54
class UOverlay * ShieldOverlay
Definition HealthWidget.h:58

◆ InjuredBodyPart()

void UHealthWidget::InjuredBodyPart ( EBodyPartName InjuredBodyPart,
FVector HitLocation,
const TArray< FBodyPart > & AllBodyParts )

◆ NativeConstruct()

void UHealthWidget::NativeConstruct ( )
overrideprotectedvirtual
43{
44 Super::NativeConstruct();
45 if(Spacer != nullptr)
46 {
47 Spacer->SetSize(SpacerSize);
48 }
49}
FVector2D SpacerSize
Definition HealthWidget.h:35

◆ NativePreConstruct()

void UHealthWidget::NativePreConstruct ( )
overrideprotectedvirtual
32{
33 Super::NativePreConstruct();
34 if(Spacer != nullptr)
35 {
36 Spacer->SetSize(SpacerSize);
37 }
38 // HealthBar->SetWidgetStyle()
39
40}

◆ SetHasShield()

void UHealthWidget::SetHasShield ( const bool in_bHasShield)
54{
55 bHasShield = in_bHasShield;
56 if(!bHasShield)
57 {
58 ShieldBar->SetVisibility(ESlateVisibility::Collapsed);
59 }
60}
bool bHasShield
Definition HealthWidget.h:65

◆ ShieldBroken()

void UHealthWidget::ShieldBroken ( )

◆ UpdateHealth()

void UHealthWidget::UpdateHealth ( const float CurrentHealth,
const float MaxHealth,
const class UDamageType * DamageType )

◆ UpdateHealthAndShield()

void UHealthWidget::UpdateHealthAndShield ( const float CurrentHealth,
const float MaxHealth,
const float CurrentShieldHealth,
const float MaxShieldHealth,
const class UDamageType * DamageType = nullptr )

Member Data Documentation

◆ BarSize

FVector2D UHealthWidget::BarSize

◆ bHasShield

bool UHealthWidget::bHasShield = false
private

◆ HealthBar

class UProgressBar* UHealthWidget::HealthBar
protected

◆ HealthDamageStyle

FProgressBarStyle UHealthWidget::HealthDamageStyle

◆ HealthOverlay

class UOverlay* UHealthWidget::HealthOverlay
protected

◆ HealthStyle

FProgressBarStyle UHealthWidget::HealthStyle

◆ ShieldBar

class UProgressBar* UHealthWidget::ShieldBar
protected

◆ ShieldDamageStyle

FProgressBarStyle UHealthWidget::ShieldDamageStyle

◆ ShieldOverlay

class UOverlay* UHealthWidget::ShieldOverlay
protected

◆ ShieldStyle

FProgressBarStyle UHealthWidget::ShieldStyle

◆ Spacer

class USpacer* UHealthWidget::Spacer
protected

◆ SpacerSize

FVector2D UHealthWidget::SpacerSize = FVector2D(0.0f, 4.0f)

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