afegit fade de audio al final de Ending

This commit is contained in:
2025-11-21 20:06:30 +01:00
parent 2fd101674e
commit d27f978c62
2 changed files with 9 additions and 3 deletions

View File

@@ -156,7 +156,10 @@ void Ending::updateState(float delta_time) {
break;
case State::ENDING:
// Transición a ENDING2
// Esperar ENDING_DURATION y luego transicionar a ENDING2
if (state_time_ >= ENDING_DURATION) {
SceneManager::current = SceneManager::Scene::ENDING2;
}
break;
}
}
@@ -521,8 +524,9 @@ void Ending::checkChangeScene() {
// Comprobar si ha pasado la duración de la escena
if (state_time_ >= current_duration) {
if (next_state == State::ENDING) {
// Termina el bucle
SceneManager::current = SceneManager::Scene::ENDING2;
// Transición al estado ENDING con fade de audio
transitionToState(State::ENDING);
Audio::get()->fadeOutMusic(MUSIC_FADE_DURATION);
} else {
// Transición a la siguiente escena
current_scene_++;

View File

@@ -68,6 +68,8 @@ class Ending {
static constexpr float IMAGE_REVEAL_SPEED = 60.0F; // 2px cada 2 frames @ 60fps
static constexpr float TEXT_LAPSE = 1.333F; // 80 frames @ 60fps
static constexpr float FADEOUT_START_OFFSET = 1.667F; // Inicio fade-out 100 frames antes del fin
static constexpr float ENDING_DURATION = 2.0F; // Duración del estado ENDING (2 segundos)
static constexpr int MUSIC_FADE_DURATION = 1800; // Fade de audio en milisegundos (1.8 segundos)
// --- Métodos ---
void update(); // Actualiza el objeto