|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
// Bevy basically forces "complex types" with Querys
|
|
|
|
|
#![allow(clippy::type_complexity)]
|
|
|
|
|
|
|
|
|
|
use bevy::color::palettes::tailwind::FUCHSIA_950;
|
|
|
|
|
use bevy::render::view::{ColorGrading, ColorGradingGlobal};
|
|
|
|
|
use games::physics2d::*;
|
|
|
|
|
use games::*;
|
|
|
|
|
@ -83,7 +84,10 @@ fn main() {
|
|
|
|
|
sync_resource_to_ui::<Deaths>.run_if(resource_changed::<Deaths>),
|
|
|
|
|
sync_resource_to_ui::<RewindFrames>.run_if(resource_changed::<RewindFrames>),
|
|
|
|
|
),
|
|
|
|
|
update_tooltip.run_if(in_state(DebuggingState::On)),
|
|
|
|
|
(
|
|
|
|
|
update_tooltip,
|
|
|
|
|
debug_trail,
|
|
|
|
|
).run_if(in_state(DebuggingState::On)),
|
|
|
|
|
// TODO: Add run_if to this system
|
|
|
|
|
update_batch_position.run_if(any_component_changed::<Batch>),
|
|
|
|
|
move_batches.run_if(on_event::<CollisionStarted>),
|
|
|
|
|
@ -135,10 +139,7 @@ struct Tape {
|
|
|
|
|
|
|
|
|
|
fn init_bird(
|
|
|
|
|
mut commands: Commands,
|
|
|
|
|
server: Res<AssetServer>,
|
|
|
|
|
bird_assets: Res<BirdAssets>,
|
|
|
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
|
|
|
mut materials: ResMut<Assets<ColorMaterial>>,
|
|
|
|
|
) {
|
|
|
|
|
let name = Name::new("bird");
|
|
|
|
|
|
|
|
|
|
@ -893,3 +894,26 @@ fn update_tooltip(
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn debug_trail(
|
|
|
|
|
mut physics_objects: Query<(Entity ,&Transform), With<Mass>>,
|
|
|
|
|
mut gizmos: Gizmos,
|
|
|
|
|
mut positions: Local<HashMap<Entity, VecDeque<Vec3>>>,
|
|
|
|
|
) {
|
|
|
|
|
physics_objects.iter_mut().for_each(|(e, obj)| {
|
|
|
|
|
if let Some(mut list) = positions.get_mut(&e) {
|
|
|
|
|
list.push_front(obj.translation);
|
|
|
|
|
if list.len() > 60 {
|
|
|
|
|
list.pop_back();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
positions.insert(e, vec![obj.translation].into());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
positions.iter().for_each(|(_e, list)| {
|
|
|
|
|
list.iter().for_each(|v| {
|
|
|
|
|
gizmos.cross_2d(Vec2::new(v.x, v.y), 12., FUCHSIA);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|