diff --git a/src/main.rs b/src/main.rs index 7a5e3ec..4e57af4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ pub struct GamarjobaPlugin; impl Plugin for GamarjobaPlugin { fn build(&self, app: &mut App) { app.add_startup_system(add_people) - .add_system(gamarjoba) + .insert_resource(GreetTimer(Timer::from_seconds(2.0, TimerMode::Repeating))) .add_system(greetings); } @@ -25,16 +25,17 @@ fn add_people(mut commands: Commands) { commands.spawn((Person, Name("Mak'lazi Heyorem".into()))); } -fn greetings(query: Query<&Name, With>) { - for name in &query { - println!("Gamarjoba, {}", name.0) +#[derive(Resource)] +struct GreetTimer(Timer); + +fn greetings(query: Query<&Name, With>, time: Res