Add new Weapon HUD UI

This commit is contained in:
Louis Hobbs 2023-07-03 20:05:31 +01:00
parent 4ab591e4b9
commit a402de0781
3 changed files with 43 additions and 4 deletions

BIN
Content/UI/WidgetHUD.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -412,7 +412,7 @@ int APlayerCharacter::GetCurrentAmmoCount()
{ {
if (CurrentWeapon == nullptr) if (CurrentWeapon == nullptr)
{ {
return -1; return 0;
} }
return CurrentWeapon->GetAmmoCount(); return CurrentWeapon->GetAmmoCount();
@ -422,8 +422,38 @@ float APlayerCharacter::GetCurrentHealthCount()
{ {
if (!GetHealthComponent()) if (!GetHealthComponent())
{ {
return -1; return 0;
} }
return GetHealthComponent()->GetCurrentHealth(); return GetHealthComponent()->GetCurrentHealth();
} }
int APlayerCharacter::GetWeaponProjectiles()
{
if (CurrentWeapon == nullptr)
{
return 0;
}
return CurrentWeapon->GetWeaponProperties()->ProjectilesPerShot;
}
float APlayerCharacter::GetWeaponCooldown()
{
if (CurrentWeapon == nullptr)
{
return 0;
}
return CurrentWeapon->GetWeaponProperties()->WeaponCooldown;
}
float APlayerCharacter::GetWeaponSpread()
{
if (CurrentWeapon == nullptr)
{
return 0;
}
return CurrentWeapon->GetWeaponProperties()->WeaponSpread;
}

View File

@ -129,6 +129,15 @@ public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
float GetCurrentHealthCount(); float GetCurrentHealthCount();
UFUNCTION(BlueprintCallable)
int GetWeaponProjectiles();
UFUNCTION(BlueprintCallable)
float GetWeaponCooldown();
UFUNCTION(BlueprintCallable)
float GetWeaponSpread();
protected: protected:
virtual void CalculateHits(TArray<FHitResult>* hits) override; virtual void CalculateHits(TArray<FHitResult>* hits) override;