Disallow Sprinting and Aiming Downsights at the same time
This commit is contained in:
parent
23db1dff33
commit
91f2befa71
|
@ -298,22 +298,24 @@ void APlayerCharacter::QuitCallback(const FInputActionInstance& Instance)
|
|||
|
||||
void APlayerCharacter::SetSprintingCallback(const FInputActionInstance& Instance)
|
||||
{
|
||||
if (UNakatomiCMC* cmc = GetCharacterMovementComponent())
|
||||
UNakatomiCMC* cmc = GetCharacterMovementComponent();
|
||||
|
||||
if (!IsADS && cmc)
|
||||
{
|
||||
cmc->EnableSprint();
|
||||
IsSprinting = true;
|
||||
}
|
||||
|
||||
IsSprinting = true;
|
||||
}
|
||||
|
||||
void APlayerCharacter::SetWalkingCallback(const FInputActionInstance& Instance)
|
||||
{
|
||||
if (UNakatomiCMC* cmc = GetCharacterMovementComponent())
|
||||
UNakatomiCMC* cmc = GetCharacterMovementComponent();
|
||||
|
||||
if (!IsADS && cmc)
|
||||
{
|
||||
cmc->DisableSprint();
|
||||
IsSprinting = false;
|
||||
}
|
||||
|
||||
IsSprinting = false;
|
||||
}
|
||||
|
||||
void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
|
||||
|
@ -518,6 +520,11 @@ void APlayerCharacter::WeaponSwitchingCallback(const FInputActionInstance& Insta
|
|||
|
||||
void APlayerCharacter::BeginAimDownSightsCallback(const FInputActionInstance& Instance)
|
||||
{
|
||||
if (IsSprinting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsADS = true;
|
||||
|
||||
if (UNakatomiCMC* cmc = GetCharacterMovementComponent())
|
||||
|
@ -544,6 +551,11 @@ void APlayerCharacter::BeginAimDownSightsCallback(const FInputActionInstance& In
|
|||
|
||||
void APlayerCharacter::EndAimDownSightsCallback(const FInputActionInstance& Instance)
|
||||
{
|
||||
if (IsSprinting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsADS = false;
|
||||
|
||||
if (UNakatomiCMC* cmc = GetCharacterMovementComponent())
|
||||
|
|
Loading…
Reference in New Issue