corregit audio i timing del game over
This commit is contained in:
@@ -118,6 +118,10 @@ Game::~Game() {
|
||||
manager->saveToFile(Asset::get()->get("score.bin"));
|
||||
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
|
||||
Audio::get()->stopMusic();
|
||||
if (Options::audio.enabled) {
|
||||
Audio::get()->stopAllSounds();
|
||||
Audio::get()->setSoundVolume(Options::audio.sound.volume, Audio::Group::GAME);
|
||||
}
|
||||
}
|
||||
ServiceMenu::get()->setStateChangeCallback(nullptr);
|
||||
|
||||
@@ -339,11 +343,10 @@ void Game::updateGameStateGameOver(float deltaTime) {
|
||||
}
|
||||
}
|
||||
|
||||
if (fade_out_->isEnabled()) {
|
||||
if (Options::audio.enabled) {
|
||||
const float VOL = static_cast<float>(64 * (100 - fade_out_->getValue())) / 100.0F;
|
||||
Audio::get()->setSoundVolume(static_cast<int>(VOL), Audio::Group::GAME);
|
||||
}
|
||||
if (Options::audio.enabled) {
|
||||
const float progress = std::min(game_over_timer_ / GAME_OVER_DURATION_S, 1.0f);
|
||||
const float VOL = 64.0f * (1.0f - progress);
|
||||
Audio::get()->setSoundVolume(static_cast<int>(VOL), Audio::Group::GAME);
|
||||
}
|
||||
|
||||
if (fade_out_->hasEnded()) {
|
||||
@@ -353,10 +356,6 @@ void Game::updateGameStateGameOver(float deltaTime) {
|
||||
Section::name = Section::Name::HI_SCORE_TABLE; // La partida ha terminado con la derrota de los jugadores
|
||||
}
|
||||
Section::options = Section::Options::HI_SCORE_AFTER_PLAYING;
|
||||
if (Options::audio.enabled) {
|
||||
Audio::get()->stopAllSounds();
|
||||
Audio::get()->setSoundVolume(Options::audio.sound.volume, Audio::Group::GAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user