Add Pause Action
This commit is contained in:
parent
a00f453b87
commit
4294658f41
BIN
Content/Input/IA_Pause.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Input/IA_Pause.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Input/IMC_Player.uasset
(Stored with Git LFS)
BIN
Content/Input/IMC_Player.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Player/BP_PlayerController.uasset
(Stored with Git LFS)
BIN
Content/Player/BP_PlayerController.uasset
(Stored with Git LFS)
Binary file not shown.
@ -25,6 +25,9 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||||
void Input_Move(FVector2D value);
|
void Input_Move(FVector2D value);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||||
|
void Input_Pause();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||||
UInputMappingContext* Input_GetInputMappingContext();
|
UInputMappingContext* Input_GetInputMappingContext();
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ void AVampirePlayerController::SetupInputComponent()
|
|||||||
if (UEnhancedInputComponent* EIP = CastChecked<UEnhancedInputComponent>(InputComponent))
|
if (UEnhancedInputComponent* EIP = CastChecked<UEnhancedInputComponent>(InputComponent))
|
||||||
{
|
{
|
||||||
EIP->BindAction(MovementAction, ETriggerEvent::Triggered, this, &AVampirePlayerController::Move);
|
EIP->BindAction(MovementAction, ETriggerEvent::Triggered, this, &AVampirePlayerController::Move);
|
||||||
|
EIP->BindAction(PauseAction, ETriggerEvent::Triggered, this, &AVampirePlayerController::OnPause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +82,22 @@ void AVampirePlayerController::Move(const FInputActionValue& MovementInput)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AVampirePlayerController::OnPause(const FInputActionValue& PauseInput)
|
||||||
|
{
|
||||||
|
if (APawn* pawn = GetPawn())
|
||||||
|
{
|
||||||
|
if (UKismetSystemLibrary::DoesImplementInterface(pawn, UInputable::StaticClass()))
|
||||||
|
{
|
||||||
|
IInputable::Execute_Input_Pause(pawn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SetPause(true))
|
||||||
|
{
|
||||||
|
//TODO: Add pause screen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AVampirePlayerController::UpdatePlayerEXPHUD(int exp, float currentLevelPercent)
|
void AVampirePlayerController::UpdatePlayerEXPHUD(int exp, float currentLevelPercent)
|
||||||
{
|
{
|
||||||
if (currentPlayerHUD)
|
if (currentPlayerHUD)
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
#include "VampirePlayerController.generated.h"
|
#include "VampirePlayerController.generated.h"
|
||||||
|
|
||||||
|
struct FInputActionValue;
|
||||||
class UInputAction;
|
class UInputAction;
|
||||||
class UHUDWidget;
|
class UHUDWidget;
|
||||||
/**
|
/**
|
||||||
@ -25,6 +26,8 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
UInputAction* MovementAction;
|
UInputAction* MovementAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
UInputAction* PauseAction;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -42,6 +45,9 @@ protected:
|
|||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Move(const FInputActionValue& MovementInput);
|
void Move(const FInputActionValue& MovementInput);
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OnPause(const FInputActionValue& PauseInput);
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void UpdatePlayerEXPHUD(int exp, float currentLevelPercent);
|
void UpdatePlayerEXPHUD(int exp, float currentLevelPercent);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user