Added base logic for the pause

Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
TjgL 2025-02-26 22:40:05 +01:00
parent ae9df6f8d9
commit a57baaea5f
9 changed files with 34 additions and 6 deletions

BIN
Content/Legumix/Player/BP_Play.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Legumix/Player/HUD/WP_PauseMenu.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Player/Input/IA_Pause.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -135,6 +135,10 @@ FVector ALMPlayer::GetWeaponFiringOrigin()
FVector ALMPlayer::GetAimVector() { return GetCam()->GetForwardVector(); } FVector ALMPlayer::GetAimVector() { return GetCam()->GetForwardVector(); }
void ALMPlayer::OnPause_Implementation(bool Paused)
{
}
UCameraComponent* ALMPlayer::GetCam() UCameraComponent* ALMPlayer::GetCam()
{ {
if (!Camera) if (!Camera)

View File

@ -6,6 +6,7 @@
#include "EnhancedInputComponent.h" #include "EnhancedInputComponent.h"
#include "LMUserSettings.h" #include "LMUserSettings.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "Kismet/GameplayStatics.h"
#include "Player/LMPlayer.h" #include "Player/LMPlayer.h"
#include "Weapon/LMWeaponManager.h" #include "Weapon/LMWeaponManager.h"
@ -28,6 +29,7 @@ void ALMPlayerController::SetupInputComponent()
Input->BindAction(FireAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Fire); Input->BindAction(FireAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Fire);
Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload); Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload);
Input->BindAction(ScrollAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Scroll); Input->BindAction(ScrollAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Scroll);
Input->BindAction(PauseAction, ETriggerEvent::Triggered, this, &ALMPlayerController::PauseGame);
} }
} }
@ -68,3 +70,12 @@ void ALMPlayerController::Scroll(const FInputActionValue& InputValue)
const float ScrollAmount = InputValue.Get<float>(); const float ScrollAmount = InputValue.Get<float>();
LegumixPlayer->GetWeaponManager()->SwitchWeapon(ScrollAmount); LegumixPlayer->GetWeaponManager()->SwitchWeapon(ScrollAmount);
} }
void ALMPlayerController::PauseGame(const FInputActionValue& InputValue)
{
const bool bIsPaused = UGameplayStatics::IsGamePaused(GetWorld());
UGameplayStatics::SetGamePaused(GetWorld(), !bIsPaused);
SetShowMouseCursor(!bIsPaused);
LegumixPlayer->OnPause(!bIsPaused);
}

View File

@ -83,6 +83,9 @@ public:
UFUNCTION(BlueprintImplementableEvent, Category=Legumix) UFUNCTION(BlueprintImplementableEvent, Category=Legumix)
void OnReload(); void OnReload();
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
void OnPause(bool Paused);
public: public:
UFUNCTION(BlueprintImplementableEvent) UFUNCTION(BlueprintImplementableEvent)
UCameraComponent* GetCamera(); UCameraComponent* GetCamera();

View File

@ -45,6 +45,9 @@ private:
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = true)) UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = true))
TObjectPtr<UInputAction> ScrollAction; TObjectPtr<UInputAction> ScrollAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = true))
TObjectPtr<UInputAction> PauseAction;
UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = true)) UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = true))
TObjectPtr<ALMPlayer> LegumixPlayer; TObjectPtr<ALMPlayer> LegumixPlayer;
@ -55,4 +58,5 @@ private:
void Fire(const FInputActionValue& InputValue); void Fire(const FInputActionValue& InputValue);
void Reload(const FInputActionValue& InputValue); void Reload(const FInputActionValue& InputValue);
void Scroll(const FInputActionValue& InputValue); void Scroll(const FInputActionValue& InputValue);
void PauseGame(const FInputActionValue& InputValue);
}; };