diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index 28795a7f..e5e6c0d5 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -28,9 +28,9 @@ public: virtual void Reset(); void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer); - bool SniperSprintingCheck(); virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; } virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; } + bool SpecialAbilityKeyDown() const { return m_SpecialAbilityKeyDown; } protected: const int m_PlayerID; @@ -145,10 +145,10 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm if (m_NumberOfMovementKeysDown == 0) { m_MovementKeyDown = false; } - //you have just released the key, store what key it was and reset the doubletap-sensitivity-timer - m_AssaultDashTapDirection = m_CurrentDirectionVector; - m_AssaultDashDoubleTapDeltaTime = 0.f; - + //you have just released the key, store what key it was and reset the doubletap-sensitivity-timer + m_AssaultDashTapDirection = m_CurrentDirectionVector; + m_AssaultDashDoubleTapDeltaTime = 0.f; + } } @@ -161,12 +161,9 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm } if (e.Command == "SpecialAbility") { - if (e.Value > 0) { - m_SpecialAbilityKeyDown = true; - } else { - m_SpecialAbilityKeyDown = false; - } + m_SpecialAbilityKeyDown = e.Value > 0; } + if (m_SpecialAbilityKeyDown && m_MovementKeyDown) { m_ShiftDashing = true; } else { @@ -241,12 +238,4 @@ void FirstPersonInputController::AssaultDashCheck(double dt, bool m_EventBroker->Publish(e); } -template -bool FirstPersonInputController::SniperSprintingCheck() { - if (m_SpecialAbilityKeyDown) { - return true; - } else { - return false; - } -} #endif \ No newline at end of file diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 8bcf092f..07090425 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -68,7 +68,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt) } bool sniperSprinting = false; if (player.HasComponent("SprintAbility")) { - if (controller->SniperSprintingCheck()) { + if (controller->SpecialAbilityKeyDown()) { playerMovementSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"]; playerCrouchSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"]; sniperSprinting = true;