refactor(): minor tweaks & cleanups

This commit is contained in:
kaosat.dev 2023-07-27 00:07:04 +02:00
parent 6b769e1ba1
commit cf6af7b3ef
5 changed files with 7 additions and 16 deletions

View File

@ -2,14 +2,12 @@ pub mod physics_replace_proxies;
pub use physics_replace_proxies::*; pub use physics_replace_proxies::*;
pub mod utils; pub mod utils;
pub(crate) use utils::*;
pub mod controls; pub mod controls;
pub use controls::*; pub use controls::*;
use bevy::prelude::*; use bevy::prelude::*;
// use crate::state::{GameState}; // use crate::Collider;
use crate::Collider;
pub struct PhysicsPlugin; pub struct PhysicsPlugin;
impl Plugin for PhysicsPlugin { impl Plugin for PhysicsPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {

View File

@ -1,5 +1,5 @@
use bevy::prelude::*; use bevy::prelude::*;
use bevy::render::primitives::Aabb; // use bevy::render::primitives::Aabb;
use bevy_rapier3d::geometry::Collider as RapierCollider; use bevy_rapier3d::geometry::Collider as RapierCollider;
use bevy_rapier3d::dynamics::RigidBody as RapierRigidBody; use bevy_rapier3d::dynamics::RigidBody as RapierRigidBody;
use bevy_rapier3d::prelude::{ComputedColliderShape, ActiveEvents, ActiveCollisionTypes}; use bevy_rapier3d::prelude::{ComputedColliderShape, ActiveEvents, ActiveCollisionTypes};

View File

@ -3,17 +3,12 @@ use core::ops::Deref;
use serde_json::Value; use serde_json::Value;
use serde::de::DeserializeSeed; use serde::de::DeserializeSeed;
use serde::{Deserialize, Serialize};
use bevy::prelude::*; use bevy::prelude::*;
use bevy::reflect::serde::{UntypedReflectDeserializer, ReflectSerializer}; use bevy::reflect::serde::{UntypedReflectDeserializer, ReflectSerializer};
use bevy::reflect::TypeRegistryInternal; use bevy::reflect::TypeRegistryInternal;
use bevy::gltf::{Gltf, GltfExtras}; use bevy::gltf::{Gltf, GltfExtras};
use crate::Player;
use crate::camera::{CameraTracking, CameraTrackingOffset};
use super::capitalize_first_letter; use super::capitalize_first_letter;
pub fn gltf_extras_to_components( pub fn gltf_extras_to_components(
@ -120,7 +115,7 @@ pub fn gltf_extras_to_components(
type_registry: &TypeRegistryInternal type_registry: &TypeRegistryInternal
) -> Vec<Box<dyn Reflect>> { ) -> Vec<Box<dyn Reflect>> {
println!("RON string {}", ron_string); println!("RON string {}", ron_string);
let lookup: HashMap<String, Value> = ron::from_str(ron_string.as_str()).unwrap(); //serde_json::from_str(ron_string.as_str()).unwrap(); let lookup: HashMap<String, Value> = ron::from_str(ron_string.as_str()).unwrap();
let mut components: Vec<Box<dyn Reflect>> = Vec::new(); let mut components: Vec<Box<dyn Reflect>> = Vec::new();
for (key, value) in lookup.into_iter() { for (key, value) in lookup.into_iter() {
println!("KEY {} , VALUE {}", key, value); println!("KEY {} , VALUE {}", key, value);
@ -148,7 +143,7 @@ pub fn gltf_extras_to_components(
} }
} }
let mut ron_string = format!(" let ron_string = format!("
{{ {{
\"{}\":{} \"{}\":{}
}}", }}",

View File

@ -6,7 +6,6 @@ use bevy::prelude::*;
pub struct EcsRelationshipsPlugin; pub struct EcsRelationshipsPlugin;
impl Plugin for EcsRelationshipsPlugin { impl Plugin for EcsRelationshipsPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app app;
;
} }
} }

View File

@ -63,14 +63,13 @@ pub fn test_collision_events(
mut contact_force_events: EventReader<ContactForceEvent>, mut contact_force_events: EventReader<ContactForceEvent>,
) )
{ {
for collision_event in collision_events.iter() { for collision_event in collision_events.iter() {
println!("collision"); println!("collision");
match collision_event { match collision_event {
CollisionEvent::Started(entity1, entity2 ,_) => { CollisionEvent::Started(_entity1, _entity2 ,_) => {
println!("collision started") println!("collision started")
} }
CollisionEvent::Stopped(entity1, entity2 ,_) => { CollisionEvent::Stopped(_entity1, _entity2 ,_) => {
println!("collision ended") println!("collision ended")
} }