use bevy::prelude::*; use iyes_loopless::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .insert_resource(MyTimer::new()) .insert_resource(GameMode::Multiplayer) .init_resource::() .add_system( notify .run_if(in_multiplayer) .run_if(on_mytimer) // labels and ordering must come at the end .after("tick"), ) .add_system( tick_mytimer .run_if(in_multiplayer) .run_if(spacebar_pressed) .label("tick") ) .run(); } /// Condition checking our timer fn on_mytimer(mytimer: Res) -> bool { mytimer.timer.just_finished() } /// Condition checking if we are connected to multiplayer server fn in_multiplayer(gamemode: Res, connected: Res) -> bool { *gamemode == GameMode::Multiplayer && connected.is_active() } /// Condition checking if spacebar is pressed fn spacebar_pressed(kbd: Res>) -> bool { kbd.pressed(KeyCode::Space) } fn notify() { println!("BAM!"); } /// Timers gotta be ticked fn tick_mytimer(mut mytimer: ResMut, time: Res