playerMovementSpeed,playerCrouchSpeed in the player component now also gets AssaultBoosted.

This commit is contained in:
verysecrethero
2016-02-17 16:04:44 +01:00
parent e8aff02c4e
commit 1c9a1a9904
3 changed files with 19 additions and 13 deletions
+7 -1
View File
@@ -53,6 +53,11 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
float playerMovementSpeed = player["Player"]["MovementSpeed"];
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
glm::vec3& wishDirection = player["Player"]["CurrentWishDirection"];
if (player.HasComponent("BoostAssault")) {
playerMovementSpeed *= (double)player["BoostAssault"]["StrengthOfEffect"];
playerCrouchSpeed *= (double)player["BoostAssault"]["StrengthOfEffect"];
}
if (player.HasComponent("Physics")) {
ComponentWrapper cPhysics = player["Physics"];
@@ -104,9 +109,10 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
//if doubleTapped do Assault Dash - but only boost maximum 50.0f
float doubleTapDashBoost = controller->AssaultDashDoubleTapped() ? 40.0f : 1.0f;
accelerationSpeed = glm::min(doubleTapDashBoost*glm::min(accelerationSpeed, addSpeed), 50.0f);
accelerationSpeed = doubleTapDashBoost*glm::min(accelerationSpeed, addSpeed);
//if player has Boost from an Assault class, accelerate the player faster
if (player.HasComponent("BoostAssault")) {
accelerationSpeed *= (double) player["BoostAssault"]["StrengthOfEffect"];
accelerationSpeed *= (double)player["BoostAssault"]["StrengthOfEffect"];
}
velocity += accelerationSpeed * wishDirection;
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));