Add Pause Menu Widget to Player Character
This commit is contained in:
		
							parent
							
								
									322b872042
								
							
						
					
					
						commit
						29b06222a5
					
				| @ -90,6 +90,11 @@ void APlayerCharacter::BeginPlay() | |||||||
| 			currentPlayerHUD->AddToViewport(); | 			currentPlayerHUD->AddToViewport(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	if (PauseMenuWidget) | ||||||
|  | 	{ | ||||||
|  | 		currentPauseMenuWidget = CreateWidget<UUserWidget>(GetWorld(), PauseMenuWidget); | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void APlayerCharacter::Destroyed() | void APlayerCharacter::Destroyed() | ||||||
| @ -489,6 +494,10 @@ void APlayerCharacter::EndAimDownSightsCallback(const FInputActionInstance& Inst | |||||||
| 
 | 
 | ||||||
| void APlayerCharacter::PauseCallback(const FInputActionInstance& Instance) | void APlayerCharacter::PauseCallback(const FInputActionInstance& Instance) | ||||||
| { | { | ||||||
|  | 	if (PauseMenuWidget) | ||||||
|  | 	{ | ||||||
|  | 		// TODO: Add pause functionality
 | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void APlayerCharacter::OnFire() | void APlayerCharacter::OnFire() | ||||||
|  | |||||||
| @ -73,6 +73,9 @@ public: | |||||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||||
| 	TSubclassOf<class UUserWidget> PlayerHUD; | 	TSubclassOf<class UUserWidget> PlayerHUD; | ||||||
| 
 | 
 | ||||||
|  | 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||||
|  | 	TSubclassOf<class UUserWidget> PauseMenuWidget; | ||||||
|  | 
 | ||||||
| 	FOnEnemyHitDelegate OnEnemyHit; | 	FOnEnemyHitDelegate OnEnemyHit; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
| @ -111,6 +114,8 @@ private: | |||||||
| 
 | 
 | ||||||
| 	class UUserWidget* currentPlayerHUD; | 	class UUserWidget* currentPlayerHUD; | ||||||
| 
 | 
 | ||||||
|  | 	UUserWidget* currentPauseMenuWidget; | ||||||
|  | 
 | ||||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, Meta = (AllowPrivateAccess = "true")) | 	UPROPERTY(EditAnywhere, BlueprintReadWrite, Meta = (AllowPrivateAccess = "true")) | ||||||
| 	UAIPerceptionStimuliSourceComponent* PerceptionSource; | 	UAIPerceptionStimuliSourceComponent* PerceptionSource; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user