Crate bevy_time_runner
source ·Expand description
§bevy_time_runner
§TimeRunner
TimeRunner
will expects you to create an entity containing the TimeRunner
component and their children to contain the TimeSpan
component like so:
use bevy::prelude::*;
use bevy_time_runner::{TimeRunner, TimeSpan};
fn secs(secs: u64) -> Duration {
Duration::from_secs(secs)
}
commands
.spawn(TimeRunner::new(secs(10)))
.with_children(|c| {
c.spawn(TimeSpan::try_from(secs(0)..secs(3)).unwrap());
c.spawn(TimeSpan::try_from(secs(3)..secs(7)).unwrap());
c.spawn(TimeSpan::try_from(secs(7)..secs(10)).unwrap());
});
While the TimeRunner
is running, for each child with the component TimeSpan
,
the component TimeSpanProgress
will be inserted to each child with the appropriate
values and removed if the runner is out of range of the span.
This creates a very flexible timing system that’s useful for variety of purposes.
Structs§
- Skip a
TimeRunner
. - Advanced timer
- Contains the current elasped time per tick. Have more informations useful for handling edge cases and retain timing accuracy.
- Fired when a time runner repeated or completed
- TimeRunnerPlugin
bevy_app
Addtime_runner_system
RegistersTimeRunner
- Define the range of time
TimeSpanProgress
is automatically managed by its runner.
Enums§
- Error type for when creating a new
TimeSpan
. - Timer repeat configuration
- Time runner repeat behavior
- Bounding enum for
Duration
to be exclusivively checked or inclusivively checked. - Time direciton
- System set in this crate
Functions§
- Tick time runner then send
TimeRunnerEnded
event if qualified for. - System for updating any
TimeSpan
with the correctTimeSpanProgress
by their runner