use crate::domain::*; use bevy::prelude::*; /// Запланировать установку скорости движения [Velocity] при следующем событии [GridBarier] pub fn schedule_set_velocity(tail: Entity) -> impl Fn(On, Commands, Query<(&mut Velocity, &Transform)>) { move |event: On, mut commands: Commands, mut query: Query<(&mut Velocity, &Transform)>| { if let Ok((mut velocity, transform)) = query.get_mut(tail) { let position = Position::from(transform); if event.position != position { velocity.0 = SNAKE_VELOCITY as f32; commands.entity(event.observer()).despawn(); } } } }