1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use ;
use *;
use *;
use ;
/// Represents a fixed simulation time step in seconds.
///
/// This resource defines how much simulation time advances per frame.
/// It is typically set at the beginning and remains constant throughout the simulation.
; // in seconds
/// Represents the current simulation time in seconds.
///
/// This resource is incremented every frame using the [`DeltaTime`] value.
/// It can be queried in systems to determine the current simulated time.
; // in seconds
/// Advances the simulation time by one step using the configured [`DeltaTime`] value.
///
/// This system updates the [`Time`] resource by adding `dt` at the start of every frame.
///
/// # Scheduling
/// Runs in the [`First`] schedule, ensuring it executes before most other systems.
/// Provides global simulation time tracking for deterministic, fixed-step simulations.
///
/// # Features:
/// - Adds the [`Time`] resources.
/// - Automatically advances [`Time`] by [`DeltaTime`] every frame.
/// - Runs the time advancement system early in the frame (`First` schedule).
///
/// # Example Usage:
/// ```rust
/// use bevy_ecs::prelude::*;
/// use bevy_app::prelude::*;
/// use rustpower::timeseries::sim_time::Time;
/// fn print_time(t: Res<Time>) {
/// println!("Sim Time: {}", t.elapsed_seconds());
/// }
/// let mut app = App::default();
/// app.add_systems(Update, print_time);
/// ```
///
/// # Scheduling Behavior:
/// - [`advance`] is run in the [`First`] schedule to ensure systems in `Update` see the updated time.
;