Compare commits
	
		
			2 Commits
		
	
	
		
			5e0433905f
			...
			29246357dc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 29246357dc | |||
| 7d8015acf0 | 
							
								
								
									
										
											BIN
										
									
								
								Content/UI/EnemyHealthbar/EnemyHealthbar.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/UI/EnemyHealthbar/EnemyHealthbar.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Content/UI/EnemyHealthbar/M_WhitePixel.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/UI/EnemyHealthbar/M_WhitePixel.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@ -13,7 +13,8 @@ void UEnemyHealthbarUserWidget::BindOwner(AEnemyCharacter* NewOwner)
 | 
			
		||||
	{
 | 
			
		||||
		auto healthComponent = Owner->GetHealthComponent(); 
 | 
			
		||||
		healthComponent->OnDamaged.BindUFunction(this, "UpdateHealthbar");
 | 
			
		||||
		UpdateHealthbar();
 | 
			
		||||
		float percent = Owner->GetHealthComponent()->GetCurrentHealth() / Owner->GetHealthComponent()->GetMaxHealth();
 | 
			
		||||
		Healthbar->SetPercent(percent);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -22,6 +23,7 @@ void UEnemyHealthbarUserWidget::UpdateHealthbar()
 | 
			
		||||
	if (Owner)
 | 
			
		||||
	{
 | 
			
		||||
		float percent = Owner->GetHealthComponent()->GetCurrentHealth() / Owner->GetHealthComponent()->GetMaxHealth();
 | 
			
		||||
		Healthbar->SetPercent(percent); 		
 | 
			
		||||
		Healthbar->SetPercent(percent);
 | 
			
		||||
		PlayAnimation(RevealHealthbar);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,9 @@ public:
 | 
			
		||||
	UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
 | 
			
		||||
	UProgressBar* Healthbar;
 | 
			
		||||
 | 
			
		||||
	UPROPERTY(Transient, meta = (BindWidgetAnim))
 | 
			
		||||
	UWidgetAnimation* RevealHealthbar;
 | 
			
		||||
 | 
			
		||||
	AEnemyCharacter* Owner;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user