diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index fa9af852..2bbd768d 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -45,6 +45,7 @@ protected: //and its very unlikely that someone wants to change that value const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f; std::string m_AssaultDashTapDirection = ""; + std::string m_CurrentDirectionVector = ""; bool m_AssaultDashDoubleTapped = false; bool m_PlayerIsDashing = false; bool m_ShiftDashing = false; @@ -125,17 +126,21 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm } if (e.Command == "Forward" || e.Command == "Right") { + if (e.Value != 0) { + m_CurrentDirectionVector = e.Command == "Right" ? (e.Value > 0 ? "Right" : "Left") : (e.Value > 0 ? "Forward" : "Backward"); + } //if value = 0 then you have just released this key - if (e.Value > 0 || e.Value < 0) { + if (e.Value != 0) { m_MovementKeyDown = true; //if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it - if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == e.Command) { + if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) { m_ValidDoubleTap = true; } } else { + //== 0 m_MovementKeyDown = false; //you have just released the key, store what key it was and reset the doubletap-sensitivity-timer - m_AssaultDashTapDirection = e.Command; + m_AssaultDashTapDirection = m_CurrentDirectionVector; m_AssaultDashDoubleTapDeltaTime = 0.f; } } diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index 17278f14..265a3cc5 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -30,5 +30,5 @@ - + \ No newline at end of file diff --git a/resources/Schema/Components/Dash.xml b/resources/Schema/Components/DashAbility.xml similarity index 78% rename from resources/Schema/Components/Dash.xml rename to resources/Schema/Components/DashAbility.xml index fbd255a6..25b9e19a 100644 --- a/resources/Schema/Components/Dash.xml +++ b/resources/Schema/Components/DashAbility.xml @@ -1,4 +1,4 @@ - + 2.0 \ No newline at end of file diff --git a/resources/Schema/Components/Dash.xsd b/resources/Schema/Components/DashAbility.xsd similarity index 94% rename from resources/Schema/Components/Dash.xsd rename to resources/Schema/Components/DashAbility.xsd index ca6fc366..4273cc71 100644 --- a/resources/Schema/Components/Dash.xsd +++ b/resources/Schema/Components/DashAbility.xsd @@ -3,7 +3,7 @@ - + A dash component for one of the classes diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 3029e9f7..fe24adcc 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -6,7 +6,9 @@ - + + 2.0 + diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index c65a961e..3224f579 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -42,8 +42,8 @@ void PlayerMovementSystem::Update(double dt) if (player.HasComponent("Physics")) { ComponentWrapper cPhysics = player["Physics"]; //Assault Dash Check - if (player.HasComponent("Dash")) { - controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["Dash"]["CoolDownMaxTimer"]); + if (player.HasComponent("DashAbility")) { + controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"]); } glm::vec3 wishDirection = controller->Movement() * glm::inverse(glm::quat(ori)); //this makes sure you can only dash in the 4 directions: forw,backw,left,right