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();
|
||||
}
|
||||
}
|
||||
|
||||
if (PauseMenuWidget)
|
||||
{
|
||||
currentPauseMenuWidget = CreateWidget<UUserWidget>(GetWorld(), PauseMenuWidget);
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCharacter::Destroyed()
|
||||
|
@ -489,6 +494,10 @@ void APlayerCharacter::EndAimDownSightsCallback(const FInputActionInstance& Inst
|
|||
|
||||
void APlayerCharacter::PauseCallback(const FInputActionInstance& Instance)
|
||||
{
|
||||
if (PauseMenuWidget)
|
||||
{
|
||||
// TODO: Add pause functionality
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCharacter::OnFire()
|
||||
|
|
|
@ -73,6 +73,9 @@ public:
|
|||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSubclassOf<class UUserWidget> PlayerHUD;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSubclassOf<class UUserWidget> PauseMenuWidget;
|
||||
|
||||
FOnEnemyHitDelegate OnEnemyHit;
|
||||
|
||||
protected:
|
||||
|
@ -111,6 +114,8 @@ private:
|
|||
|
||||
class UUserWidget* currentPlayerHUD;
|
||||
|
||||
UUserWidget* currentPauseMenuWidget;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Meta = (AllowPrivateAccess = "true"))
|
||||
UAIPerceptionStimuliSourceComponent* PerceptionSource;
|
||||
|
||||
|
|
Loading…
Reference in New Issue