Skip to content

Commit 47ce0bb

Browse files
Tick the timer
1 parent c678b2a commit 47ce0bb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

rfcs/45-stageless.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,17 @@ fn construction_timer_finished(timer: Res<ConstructionTimer>) -> bool {
189189
timer.finished()
190190
}
191191

192+
// Timers need to be ticked!
193+
fn tick_construction_timer(timer: ResMut<ConstructionTimer>, time: Res<Time>){
194+
timer.tick(time.delta());
195+
}
196+
192197
fn main(){
193198
App::new()
194199
.add_plugins(DefaultPlugins)
195-
// We can add functions as run criteria
196-
.add_system(update_construction_progress.run_if(construction_timer_finished))
200+
// We can add functions with read-only system parameters as run criteria
201+
.add_system_chain([tick_construction_timer,
202+
update_construction_progress.run_if(construction_timer_finished)])
197203
// We can use closures for simple one-off run criteria,
198204
// which automatically fetch the appropriate data from the `World`
199205
.add_system(spawn_more_enemies.run_if(|difficulty: Res<Difficulty>| difficulty >= 9000))

0 commit comments

Comments
 (0)