Add Pause Player Input Action

This commit is contained in:
baz 2023-09-25 23:00:32 +01:00
parent 12db67439f
commit 322b872042
5 changed files with 25 additions and 11 deletions

BIN
Content/Input/Actions/IA_Look.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Input/InputMappingContext.uasset (Stored with Git LFS)

Binary file not shown.

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

Binary file not shown.

View File

@ -182,6 +182,11 @@ void APlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCom
Input->BindAction(ThrowExplosiveAction, ETriggerEvent::Started, this, Input->BindAction(ThrowExplosiveAction, ETriggerEvent::Started, this,
&APlayerCharacter::ThrowExplosiveCallback); &APlayerCharacter::ThrowExplosiveCallback);
} }
if (PauseAction)
{
Input->BindAction(PauseAction, ETriggerEvent::Completed, this, &APlayerCharacter::PauseCallback);
}
} }
} }
@ -482,6 +487,10 @@ void APlayerCharacter::EndAimDownSightsCallback(const FInputActionInstance& Inst
true, EMoveComponentAction::Type::Move, LatentActionInfo); true, EMoveComponentAction::Type::Move, LatentActionInfo);
} }
void APlayerCharacter::PauseCallback(const FInputActionInstance& Instance)
{
}
void APlayerCharacter::OnFire() void APlayerCharacter::OnFire()
{ {
if (!IsFiring || CurrentWeapon->GetAmmoCount() == 0) if (!IsFiring || CurrentWeapon->GetAmmoCount() == 0)

View File

@ -56,10 +56,7 @@ public:
UInputAction* ThrowExplosiveAction; UInputAction* ThrowExplosiveAction;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSoftObjectPtr<UInputMappingContext> InputMappingContext; UInputAction* PauseAction;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
int MappingPriority = 0;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UInputAction* WeaponSwitchingAction; UInputAction* WeaponSwitchingAction;
@ -67,6 +64,12 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UInputAction* AimDownSightsAction; UInputAction* AimDownSightsAction;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSoftObjectPtr<UInputMappingContext> InputMappingContext;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
int MappingPriority = 0;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<class UUserWidget> PlayerHUD; TSubclassOf<class UUserWidget> PlayerHUD;
@ -161,6 +164,8 @@ public:
void EndAimDownSightsCallback(const FInputActionInstance& Instance); void EndAimDownSightsCallback(const FInputActionInstance& Instance);
void PauseCallback(const FInputActionInstance& Instance);
virtual void OnFire() override; virtual void OnFire() override;
void WeaponCooldownHandler(); void WeaponCooldownHandler();