Code refactoring.

master
Vectozavr 2021-10-17 14:25:09 +07:00
parent fb7b4878ea
commit 813f23d655
1 changed files with 2 additions and 2 deletions

View File

@ -99,13 +99,13 @@ void PlayerController::update() {
// slow mo // slow mo
_isInSlowMo = true; _isInSlowMo = true;
_player->setVelocity(_player->velocity() / ShooterConsts::SLOW_MO_COEFFICIENT); _player->setVelocity(_player->velocity() / ShooterConsts::SLOW_MO_COEFFICIENT);
_player->setAcceleration(_player->acceleration() / (ShooterConsts::SLOW_MO_COEFFICIENT * ShooterConsts::SLOW_MO_COEFFICIENT)); _player->setAcceleration(Vec3D(0, -ShooterConsts::GRAVITY / (ShooterConsts::SLOW_MO_COEFFICIENT * ShooterConsts::SLOW_MO_COEFFICIENT), 0));
_unSlowMoSound.stop(); _unSlowMoSound.stop();
_slowMoSound.play(); _slowMoSound.play();
} else if (_isInSlowMo && !Keyboard::isKeyPressed(sf::Keyboard::LShift)) { } else if (_isInSlowMo && !Keyboard::isKeyPressed(sf::Keyboard::LShift)) {
_isInSlowMo = false; _isInSlowMo = false;
_player->setVelocity(_player->velocity() * ShooterConsts::SLOW_MO_COEFFICIENT); _player->setVelocity(_player->velocity() * ShooterConsts::SLOW_MO_COEFFICIENT);
_player->setAcceleration(Vec3D(0, -ShooterConsts::GRAVITY * ShooterConsts::SLOW_MO_COEFFICIENT * ShooterConsts::SLOW_MO_COEFFICIENT, 0)); _player->setAcceleration(Vec3D(0, -ShooterConsts::GRAVITY, 0));
_slowMoSound.stop(); _slowMoSound.stop();
_unSlowMoSound.play(); _unSlowMoSound.play();
} }