corregit audio de timeStopItem
This commit is contained in:
@@ -869,15 +869,27 @@ void Game::updateTimeStopped(float deltaTime) {
|
|||||||
// Fase de advertencia (últimos 2 segundos)
|
// Fase de advertencia (últimos 2 segundos)
|
||||||
if (time_stopped_timer_ <= WARNING_THRESHOLD_S) {
|
if (time_stopped_timer_ <= WARNING_THRESHOLD_S) {
|
||||||
static float last_sound_time = 0.0f;
|
static float last_sound_time = 0.0f;
|
||||||
|
static bool color_flash_sound_played = false;
|
||||||
|
static bool warning_phase_started = false;
|
||||||
|
|
||||||
|
// CLAC al entrar en fase de advertencia
|
||||||
|
if (!warning_phase_started) {
|
||||||
|
playSound("clock.wav");
|
||||||
|
warning_phase_started = true;
|
||||||
|
last_sound_time = 0.0f; // Reset para empezar el ciclo rápido
|
||||||
|
}
|
||||||
|
|
||||||
last_sound_time += deltaTime;
|
last_sound_time += deltaTime;
|
||||||
|
|
||||||
if (last_sound_time >= CLOCK_SOUND_INTERVAL_S) {
|
if (last_sound_time >= CLOCK_SOUND_INTERVAL_S) {
|
||||||
balloon_manager_->normalColorsToAllBalloons();
|
balloon_manager_->normalColorsToAllBalloons();
|
||||||
playSound("clock.wav");
|
playSound("clock.wav");
|
||||||
last_sound_time = 0.0f;
|
last_sound_time = 0.0f;
|
||||||
} else if (last_sound_time >= COLOR_FLASH_INTERVAL_S) {
|
color_flash_sound_played = false; // Reset flag para el próximo intervalo
|
||||||
|
} else if (last_sound_time >= COLOR_FLASH_INTERVAL_S && !color_flash_sound_played) {
|
||||||
balloon_manager_->reverseColorsToAllBalloons();
|
balloon_manager_->reverseColorsToAllBalloons();
|
||||||
playSound("clock.wav");
|
playSound("clock.wav");
|
||||||
|
color_flash_sound_played = true; // Evita que suene múltiples veces
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fase normal - solo sonido ocasional
|
// Fase normal - solo sonido ocasional
|
||||||
@@ -888,8 +900,12 @@ void Game::updateTimeStopped(float deltaTime) {
|
|||||||
sound_timer = 0.0f;
|
sound_timer = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
disableTimeStopItem();
|
// Si el timer llega a 0 o menos, desactivar
|
||||||
|
if (time_stopped_timer_ <= 0) {
|
||||||
|
playSound("clock.wav"); // CLAC final
|
||||||
|
disableTimeStopItem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user