Compare commits
No commits in common. "a25f08b83234e4f9aafb76b2e5491053a087bbdc" and "4e99898af96ef40f2a13fb53a8dc705c0a3d75f3" have entirely different histories.
a25f08b832
...
4e99898af9
BIN
Content/Assets/Bin/SM_Bin.uasset (Stored with Git LFS)
BIN
Content/Assets/Bin/SM_Bin.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/UI/HUD/WidgetHUD.uasset (Stored with Git LFS)
BIN
Content/UI/HUD/WidgetHUD.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -36,28 +36,3 @@ void UPlayerHUDWidget::ShowHitMarker()
|
|||
PlayAnimation(RevealHitmarker, 0.0f, 1, EUMGSequencePlayMode::Forward, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
FString UPlayerHUDWidget::GetHealthbarText(APlayerCharacter* PlayerCharacter)
|
||||
{
|
||||
int healthbarCharacters = 5;
|
||||
float normalised = PlayerCharacter->GetHealthComponent()->GetCurrentHealth() /
|
||||
PlayerCharacter->GetHealthComponent()->GetMaxHealth();
|
||||
float adjusted = normalised * healthbarCharacters;
|
||||
int segments = FMath::RoundToInt(adjusted);
|
||||
|
||||
FString healthBar = FString("[");
|
||||
|
||||
for (int i = 0; i < segments; i++)
|
||||
{
|
||||
healthBar.Append("=");
|
||||
}
|
||||
|
||||
for (int i = segments; i < healthbarCharacters; i++)
|
||||
{
|
||||
healthBar.Append(" ");
|
||||
}
|
||||
|
||||
healthBar.Append("]");
|
||||
|
||||
return healthBar;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#include "Blueprint/UserWidget.h"
|
||||
#include <Components/TextBlock.h>
|
||||
#include <Components/Image.h>
|
||||
|
||||
#include "PlayerCharacter.h"
|
||||
#include "PlayerHUDWidget.generated.h"
|
||||
|
||||
|
||||
|
@ -31,9 +29,6 @@ public:
|
|||
UFUNCTION()
|
||||
void ShowHitMarker();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FString GetHealthbarText(APlayerCharacter* PlayerCharacter);
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||
UTextBlock* HealthText;
|
||||
|
||||
|
|
Loading…
Reference in New Issue