fn sending_system(mut event_writer: EventWriter<MyEvent>) {
    let random_value: f32 = rand::random();
    if random_value > 0.5 {
        event_writer.send(MyEvent {
            message: "A random event with value > 0.5".to_string(),
            random_value,
        });
    }
}
// In every frame we will send an event with a 50/50 chance
In every frame we will send an event with a 50/50 chance
In every frame we will send an event with a 50 / 50 chance
fn sending_system(mut event_writer: EventWriter<MyEvent>) {
    let random_value: f32 = rand::random();
    if random_value > 0.5 {
        event_writer.send(MyEvent {
            message: "A random event with value > 0.5".to_string(),
            random_value,
        });
    }
}
fn sending_system ( mut event_writer : EventWriter < MyEvent > ) { let random_value : f32 = rand :: random ( ) ; if random_value > 0.5 { event_writer . send ( MyEvent { message : " " . to_string ( ) , random_value , } ) ; } }
In every frame we will send an event with a 50/50 chance
In every frame we will send an event with a 50 / 50 chance
event_writer
EventWriter<MyEvent>
event_writer
EventWriter<MyEvent>