more reorganizing
This commit is contained in:
@@ -18,8 +18,8 @@ use crate::loaders::mesh::Mesh;
|
|||||||
use crate::paths;
|
use crate::paths;
|
||||||
use crate::physics::PhysicsManager;
|
use crate::physics::PhysicsManager;
|
||||||
use crate::render::Pipeline;
|
use crate::render::Pipeline;
|
||||||
use crate::state::StateMachine;
|
use crate::states::state::StateMachine;
|
||||||
use crate::systems::player_states::{LEAP_DURATION, ROLL_DURATION};
|
use crate::states::player_states::{LEAP_DURATION, ROLL_DURATION};
|
||||||
use crate::world::{Transform, World};
|
use crate::world::{Transform, World};
|
||||||
|
|
||||||
pub struct PlayerBundle
|
pub struct PlayerBundle
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::loaders::mesh::Mesh;
|
|||||||
use crate::paths;
|
use crate::paths;
|
||||||
use crate::physics::PhysicsManager;
|
use crate::physics::PhysicsManager;
|
||||||
use crate::render::Pipeline;
|
use crate::render::Pipeline;
|
||||||
use crate::state::StateMachine;
|
use crate::states::state::StateMachine;
|
||||||
use crate::world::{Transform, World};
|
use crate::world::{Transform, World};
|
||||||
|
|
||||||
pub struct TestCharBundle
|
pub struct TestCharBundle
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ mod physics;
|
|||||||
mod picking;
|
mod picking;
|
||||||
mod postprocess;
|
mod postprocess;
|
||||||
mod render;
|
mod render;
|
||||||
mod state;
|
mod states;
|
||||||
mod systems;
|
mod systems;
|
||||||
mod texture;
|
mod texture;
|
||||||
mod utility;
|
mod utility;
|
||||||
|
|||||||
2
src/states/mod.rs
Normal file
2
src/states/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod state;
|
||||||
|
pub mod player_states;
|
||||||
@@ -7,7 +7,7 @@ use crate::components::player_states::{
|
|||||||
};
|
};
|
||||||
use crate::entity::EntityHandle;
|
use crate::entity::EntityHandle;
|
||||||
use crate::physics::PhysicsManager;
|
use crate::physics::PhysicsManager;
|
||||||
use crate::state::PlayerState;
|
use crate::states::state::State;
|
||||||
use crate::world::World;
|
use crate::world::World;
|
||||||
|
|
||||||
pub const LEAP_DURATION: f32 = 0.18;
|
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 LEAP_SPEED: f32 = 18.0;
|
||||||
const ROLL_SPEED: f32 = 14.0;
|
const ROLL_SPEED: f32 = 14.0;
|
||||||
|
|
||||||
impl PlayerState for IdleState
|
impl State for IdleState
|
||||||
{
|
{
|
||||||
fn tick_time(&mut self, delta: f32)
|
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)
|
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)
|
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)
|
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)
|
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)
|
fn tick_time(&mut self, delta: f32)
|
||||||
{
|
{
|
||||||
@@ -4,7 +4,7 @@ use std::collections::HashMap;
|
|||||||
use crate::entity::EntityHandle;
|
use crate::entity::EntityHandle;
|
||||||
use crate::world::{Storage, World};
|
use crate::world::{Storage, World};
|
||||||
|
|
||||||
pub trait PlayerState
|
pub trait State
|
||||||
{
|
{
|
||||||
fn tick_time(&mut self, _delta: f32) {}
|
fn tick_time(&mut self, _delta: f32) {}
|
||||||
fn on_enter(&mut self, _world: &mut World, _entity: EntityHandle) {}
|
fn on_enter(&mut self, _world: &mut World, _entity: EntityHandle) {}
|
||||||
@@ -54,7 +54,7 @@ impl StateMachine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn register_state<S: PlayerState + Default + 'static>(
|
pub fn register_state<S: State + Default + 'static>(
|
||||||
&mut self,
|
&mut self,
|
||||||
storage: fn(&mut World) -> &mut Storage<S>,
|
storage: fn(&mut World) -> &mut Storage<S>,
|
||||||
)
|
)
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
pub mod camera;
|
pub mod camera;
|
||||||
pub mod dialog;
|
pub mod dialog_system;
|
||||||
pub mod dialog_camera;
|
pub mod dialog_camera;
|
||||||
pub mod dialog_projectile;
|
pub mod dialog_projectile;
|
||||||
pub mod dialog_render;
|
pub mod dialog_render;
|
||||||
pub mod follow;
|
pub mod follow;
|
||||||
pub mod input;
|
pub mod input;
|
||||||
pub mod physics_sync;
|
pub mod physics_sync;
|
||||||
pub mod player_states;
|
|
||||||
pub mod render;
|
pub mod render;
|
||||||
pub mod rotate;
|
pub mod rotate;
|
||||||
pub mod snow;
|
pub mod snow;
|
||||||
@@ -19,7 +18,7 @@ pub use camera::{
|
|||||||
camera_follow_system, camera_input_system, camera_noclip_system, camera_view_matrix,
|
camera_follow_system, camera_input_system, camera_noclip_system, camera_view_matrix,
|
||||||
start_camera_following,
|
start_camera_following,
|
||||||
};
|
};
|
||||||
pub use dialog::dialog_system;
|
pub use dialog_system::dialog_system;
|
||||||
pub use dialog_camera::dialog_camera_system;
|
pub use dialog_camera::dialog_camera_system;
|
||||||
pub use dialog_projectile::dialog_projectile_system;
|
pub use dialog_projectile::dialog_projectile_system;
|
||||||
pub use dialog_render::dialog_bubble_render_system;
|
pub use dialog_render::dialog_bubble_render_system;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use crate::components::{
|
|||||||
use crate::debug::DebugMode;
|
use crate::debug::DebugMode;
|
||||||
use crate::entity::{EntityHandle, EntityManager};
|
use crate::entity::{EntityHandle, EntityManager};
|
||||||
use crate::render::snow::SnowLayer;
|
use crate::render::snow::SnowLayer;
|
||||||
use crate::state::StateMachine;
|
use crate::states::state::StateMachine;
|
||||||
|
|
||||||
pub use crate::utility::transform::Transform;
|
pub use crate::utility::transform::Transform;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user