diff --git a/src/bundles/player.rs b/src/bundles/player.rs index 9bcd8db..38f9365 100644 --- a/src/bundles/player.rs +++ b/src/bundles/player.rs @@ -18,8 +18,8 @@ use crate::loaders::mesh::Mesh; use crate::paths; use crate::physics::PhysicsManager; use crate::render::Pipeline; -use crate::state::StateMachine; -use crate::systems::player_states::{LEAP_DURATION, ROLL_DURATION}; +use crate::states::state::StateMachine; +use crate::states::player_states::{LEAP_DURATION, ROLL_DURATION}; use crate::world::{Transform, World}; pub struct PlayerBundle diff --git a/src/bundles/test_char.rs b/src/bundles/test_char.rs index 813a912..2882192 100644 --- a/src/bundles/test_char.rs +++ b/src/bundles/test_char.rs @@ -14,7 +14,7 @@ use crate::loaders::mesh::Mesh; use crate::paths; use crate::physics::PhysicsManager; use crate::render::Pipeline; -use crate::state::StateMachine; +use crate::states::state::StateMachine; use crate::world::{Transform, World}; pub struct TestCharBundle diff --git a/src/main.rs b/src/main.rs index b65a93c..b309cb4 100755 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ mod physics; mod picking; mod postprocess; mod render; -mod state; +mod states; mod systems; mod texture; mod utility; diff --git a/src/states/mod.rs b/src/states/mod.rs new file mode 100644 index 0000000..10788bc --- /dev/null +++ b/src/states/mod.rs @@ -0,0 +1,2 @@ +pub mod state; +pub mod player_states; diff --git a/src/systems/player_states.rs b/src/states/player_states.rs similarity index 98% rename from src/systems/player_states.rs rename to src/states/player_states.rs index 75b371e..17205a7 100644 --- a/src/systems/player_states.rs +++ b/src/states/player_states.rs @@ -7,7 +7,7 @@ use crate::components::player_states::{ }; use crate::entity::EntityHandle; use crate::physics::PhysicsManager; -use crate::state::PlayerState; +use crate::states::state::State; use crate::world::World; pub const LEAP_DURATION: f32 = 0.18; @@ -15,7 +15,7 @@ pub const ROLL_DURATION: f32 = 0.42; const LEAP_SPEED: f32 = 18.0; const ROLL_SPEED: f32 = 14.0; -impl PlayerState for IdleState +impl State for IdleState { fn tick_time(&mut self, delta: f32) { @@ -87,7 +87,7 @@ impl PlayerState for IdleState } } -impl PlayerState for WalkingState +impl State for WalkingState { fn tick_time(&mut self, delta: f32) { @@ -204,7 +204,7 @@ impl PlayerState for WalkingState } } -impl PlayerState for JumpingState +impl State for JumpingState { fn tick_time(&mut self, delta: f32) { @@ -283,7 +283,7 @@ impl PlayerState for JumpingState } } -impl PlayerState for FallingState +impl State for FallingState { fn tick_time(&mut self, delta: f32) { @@ -356,7 +356,7 @@ impl PlayerState for FallingState } } -impl PlayerState for LeapingState +impl State for LeapingState { fn tick_time(&mut self, delta: f32) { @@ -430,7 +430,7 @@ impl PlayerState for LeapingState } } -impl PlayerState for RollingState +impl State for RollingState { fn tick_time(&mut self, delta: f32) { diff --git a/src/state.rs b/src/states/state.rs similarity index 98% rename from src/state.rs rename to src/states/state.rs index 2db2ac7..ece3050 100644 --- a/src/state.rs +++ b/src/states/state.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use crate::entity::EntityHandle; use crate::world::{Storage, World}; -pub trait PlayerState +pub trait State { fn tick_time(&mut self, _delta: f32) {} fn on_enter(&mut self, _world: &mut World, _entity: EntityHandle) {} @@ -54,7 +54,7 @@ impl StateMachine } } - pub fn register_state( + pub fn register_state( &mut self, storage: fn(&mut World) -> &mut Storage, ) diff --git a/src/systems/dialog.rs b/src/systems/dialog_system.rs similarity index 100% rename from src/systems/dialog.rs rename to src/systems/dialog_system.rs diff --git a/src/systems/mod.rs b/src/systems/mod.rs index 3c55d93..d16d613 100644 --- a/src/systems/mod.rs +++ b/src/systems/mod.rs @@ -1,12 +1,11 @@ pub mod camera; -pub mod dialog; +pub mod dialog_system; pub mod dialog_camera; pub mod dialog_projectile; pub mod dialog_render; pub mod follow; pub mod input; pub mod physics_sync; -pub mod player_states; pub mod render; pub mod rotate; pub mod snow; @@ -19,7 +18,7 @@ pub use camera::{ camera_follow_system, camera_input_system, camera_noclip_system, camera_view_matrix, start_camera_following, }; -pub use dialog::dialog_system; +pub use dialog_system::dialog_system; pub use dialog_camera::dialog_camera_system; pub use dialog_projectile::dialog_projectile_system; pub use dialog_render::dialog_bubble_render_system; diff --git a/src/world.rs b/src/world.rs index 8f07722..4560b1e 100644 --- a/src/world.rs +++ b/src/world.rs @@ -18,7 +18,7 @@ use crate::components::{ use crate::debug::DebugMode; use crate::entity::{EntityHandle, EntityManager}; use crate::render::snow::SnowLayer; -use crate::state::StateMachine; +use crate::states::state::StateMachine; pub use crate::utility::transform::Transform;