Added base logic for the pause
Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
parent
ae9df6f8d9
commit
a57baaea5f
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/BP_PlayerController.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_PlayerController.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/HUD/WP_PauseMenu.uasset
(Stored with Git LFS)
Normal file
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
BIN
Content/Legumix/Player/Input/IA_Pause.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Legumix/Player/Input/IMC_Default.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/Input/IMC_Default.uasset
(Stored with Git LFS)
Binary file not shown.
@ -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)
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user