bevy/crates/bevy_time/src
TimJentzsch cf3105a0db
Add run conditions for executing a system after a delay (#11095)
# Objective

I want to run a system once after a given delay.

- First, I tried using the `on_timer` run condition, but it uses a
repeating timer, causing the system to run multiple times.
- Next, I tried combining the `on_timer` with the `run_once` run
condition. However, this causes the timer to *tick* only once, so the
system is never executed.

## Solution

- ~~Replace `on_timer` by `on_time_interval` and `on_real_timer` by
`on_real_time_interval` to clarify the meaning (the old ones are
deprecated to avoid a breaking change).~~ (Reverted according to
feedback)
- Add `once_after_delay` and `once_after_real_delay` to run the system
exactly once after the delay, using `TimerMode::Once`.
- Add `repeating_after_delay` and `repeating_after_real_delay` to run
the system indefinitely after the delay, using `Timer::finished` instead
of `Timer::just_finished`.

---

## Changelog

### Added

- `once_after_delay` and `once_after_real_delay` run conditions to run
the system exactly once after the delay, using `TimerMode::Once`.
- `repeating_after_delay` and `repeating_after_real_delay` run
conditions to run the system indefinitely after the delay, using
`Timer::finished` instead of `Timer::just_finished`.
2024-01-08 23:52:16 +00:00
..
common_conditions.rs Add run conditions for executing a system after a delay (#11095) 2024-01-08 23:52:16 +00:00
fixed.rs Add First/Pre/Post/Last schedules to the Fixed timestep (#10977) 2023-12-14 04:35:40 +00:00
lib.rs Add First/Pre/Post/Last schedules to the Fixed timestep (#10977) 2023-12-14 04:35:40 +00:00
real.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
stopwatch.rs Unify FixedTime and Time while fixing several problems (#8964) 2023-10-16 01:57:55 +00:00
time.rs Add First/Pre/Post/Last schedules to the Fixed timestep (#10977) 2023-12-14 04:35:40 +00:00
timer.rs Rename Timer::{percent,percent_left} to Timer::{fraction,fraction_remaining} (#10442) 2023-11-13 14:59:42 +00:00
virt.rs Time: demote delta time clamping warning to debug (#10145) 2023-10-16 19:18:39 +00:00