use bevy::prelude::*;
use bevy_pipe_affect::prelude::*;
#[derive(Event)]
pub struct InflateEvent;
#[derive(Component)]
pub struct Inflatable;
fn inflate(
_event: On<InflateEvent>,
) -> QueryMap<&'static Transform, ComponentSet<Transform>, With<Inflatable>> {
query_map(|transform: &Transform| component_set(transform.with_scale(transform.scale * 1.1)))
}
pub fn spawn_observer() -> CommandSpawn<Observer> {
command_spawn(Observer::new(inflate.pipe(affect)))
}
pub fn trigger_observer(input: Res<ButtonInput<KeyCode>>) -> Option<CommandTrigger<InflateEvent>> {
if input.just_pressed(KeyCode::Space) {
Some(command_trigger(InflateEvent))
} else {
None
}
}