use bevy::prelude::*; use crate::domain::{Direction, GRID_SIZE, GridBarier, Head, Inert, SnakePath, Velocity}; /// Система поворота головы змеи pub fn head_rotation( input: Res>, query: Single<(&mut Transform, &mut Direction), With>, mut snake_path: ResMut, ) { use core::f32::consts::PI; let (mut transform, mut direction) = query.into_inner(); if input.just_pressed(KeyCode::ArrowLeft) { transform.rotate_z(PI / 2.0); direction.rotate_left(); snake_path.push(&transform, direction.clone()); } if input.just_pressed(KeyCode::ArrowRight) { transform.rotate_z(-PI / 2.0); direction.rotate_right(); snake_path.push(&transform, direction.clone()); } } /// Системе движения для всех движущихся сущностей pub fn moving( time: Res