Compare commits

..

No commits in common. "29246357dc43a0a7eda70b61035c3ff2b2b7d233" and "5e0433905f236b1f425760bbee94486ea0f4cec8" have entirely different histories.

4 changed files with 6 additions and 11 deletions

Binary file not shown.

Binary file not shown.

View File

@ -13,8 +13,7 @@ void UEnemyHealthbarUserWidget::BindOwner(AEnemyCharacter* NewOwner)
{ {
auto healthComponent = Owner->GetHealthComponent(); auto healthComponent = Owner->GetHealthComponent();
healthComponent->OnDamaged.BindUFunction(this, "UpdateHealthbar"); healthComponent->OnDamaged.BindUFunction(this, "UpdateHealthbar");
float percent = Owner->GetHealthComponent()->GetCurrentHealth() / Owner->GetHealthComponent()->GetMaxHealth(); UpdateHealthbar();
Healthbar->SetPercent(percent);
} }
} }
@ -24,6 +23,5 @@ void UEnemyHealthbarUserWidget::UpdateHealthbar()
{ {
float percent = Owner->GetHealthComponent()->GetCurrentHealth() / Owner->GetHealthComponent()->GetMaxHealth(); float percent = Owner->GetHealthComponent()->GetCurrentHealth() / Owner->GetHealthComponent()->GetMaxHealth();
Healthbar->SetPercent(percent); Healthbar->SetPercent(percent);
PlayAnimation(RevealHealthbar);
} }
} }

View File

@ -21,9 +21,6 @@ public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UProgressBar* Healthbar; UProgressBar* Healthbar;
UPROPERTY(Transient, meta = (BindWidgetAnim))
UWidgetAnimation* RevealHealthbar;
AEnemyCharacter* Owner; AEnemyCharacter* Owner;
public: public: