Compare commits

..

No commits in common. "a25f08b83234e4f9aafb76b2e5491053a087bbdc" and "4e99898af96ef40f2a13fb53a8dc705c0a3d75f3" have entirely different histories.

4 changed files with 2 additions and 35 deletions

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)

Binary file not shown.

View File

@ -36,28 +36,3 @@ void UPlayerHUDWidget::ShowHitMarker()
PlayAnimation(RevealHitmarker, 0.0f, 1, EUMGSequencePlayMode::Forward, 1.0f); 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;
}

View File

@ -6,8 +6,6 @@
#include "Blueprint/UserWidget.h" #include "Blueprint/UserWidget.h"
#include <Components/TextBlock.h> #include <Components/TextBlock.h>
#include <Components/Image.h> #include <Components/Image.h>
#include "PlayerCharacter.h"
#include "PlayerHUDWidget.generated.h" #include "PlayerHUDWidget.generated.h"
@ -31,9 +29,6 @@ public:
UFUNCTION() UFUNCTION()
void ShowHitMarker(); void ShowHitMarker();
UFUNCTION(BlueprintCallable)
FString GetHealthbarText(APlayerCharacter* PlayerCharacter);
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* HealthText; UTextBlock* HealthText;