fn countdown_system(time: Res<Time>, mut countdown: ResMut<Countdown>) {
    countdown.main_timer.tick(time.delta());

    // The API encourages this kind of timer state checking (if you're only checking for one value)
    // Additionally, `finished()` would accomplish the same thing as `just_finished` due to the
    // timer being repeating, however this makes more sense visually.
    if countdown.percent_trigger.tick(time.delta()).just_finished() {
        if !countdown.main_timer.finished() {
            // Print the percent complete the main timer is.
            info!(
                "Timer is {:0.0}% complete!",
                countdown.main_timer.percent() * 100.0
            );
        } else {
            // The timer has finished so we pause the percent output timer
            countdown.percent_trigger.pause();
            info!("Paused percent trigger timer")
        }
    }
}
/// This system controls ticking the timer within the countdown resource and
/// handling its state.
This system controls ticking the timer within the countdown resource and
handling its state.
This system controls ticking the timer within the countdown resource and handling its state .
fn countdown_system(time: Res<Time>, mut countdown: ResMut<Countdown>) {
    countdown.main_timer.tick(time.delta());
    // The API encourages this kind of timer state checking (if you're only checking for one value)
    // Additionally, `finished()` would accomplish the same thing as `just_finished` due to the
    // timer being repeating, however this makes more sense visually.
    if countdown.percent_trigger.tick(time.delta()).just_finished() {
        if !countdown.main_timer.finished() {
            // Print the percent complete the main timer is.
            info!(
                "Timer is {:0.0}% complete!",
                countdown.main_timer.percent() * 100.0
            );
        } else {
            // The timer has finished so we pause the percent output timer
            countdown.percent_trigger.pause();
            info!("Paused percent trigger timer")
        }
    }
}
fn countdown_system ( time : Res < Time > , mut countdown : ResMut < Countdown > ) { countdown . main_timer . tick ( time . delta ( ) ) ; // The API encourages this kind of timer state checking (if you're only checking for one value) // Additionally, `finished()` would accomplish the same thing as `just_finished` due to the // timer being repeating, however this makes more sense visually. if countdown . percent_trigger . tick ( time . delta ( ) ) . just_finished ( ) { if ! countdown . main_timer . finished ( ) { // Print the percent complete the main timer is. info ! ( " " countdown main_timer percent ( ) 100.0 ) ; } else { // The timer has finished so we pause the percent output timer countdown . percent_trigger . pause ( ) ; info ! ( " " ) } } }
This system controls ticking the timer within the countdown resource and
handling its state.
This system controls ticking the timer within the countdown resource and handling its state .
time
Res<Time>
countdown
ResMut<Countdown>
time
Res<Time>
countdown
ResMut<Countdown>