Play animation when Updating Health
This commit is contained in:
		
							parent
							
								
									5e0433905f
								
							
						
					
					
						commit
						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); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| @ -23,5 +24,6 @@ void UEnemyHealthbarUserWidget::UpdateHealthbar() | ||||
| 	{ | ||||
| 		float percent = Owner->GetHealthComponent()->GetCurrentHealth() / Owner->GetHealthComponent()->GetMaxHealth(); | ||||
| 		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