Refactor loading
This commit is contained in:
+12
-12
@@ -1,9 +1,9 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use super::{FighterStateImpl, FighterStateContext, ground, walk};
|
||||
use crate::fighter::state::{FighterState, air};
|
||||
use super::{FighterStateContext, FighterStateImpl, ground, walk};
|
||||
use crate::fighter::state::ground::GroundedStateCommon;
|
||||
use crate::fighter::state::wait::WaitState;
|
||||
use crate::fighter::state::{FighterState, air};
|
||||
use crate::fighter::{FighterAttributes, FighterVelocity, collision, motion};
|
||||
use crate::game_settings::GameSettings;
|
||||
use crate::stage::line::StageCollision;
|
||||
@@ -13,18 +13,19 @@ pub struct FallState;
|
||||
|
||||
impl FighterStateImpl for FallState {
|
||||
const NAME: &'static str = "Fall";
|
||||
fn check_interrupt(
|
||||
&self,
|
||||
state_context: &FighterStateContext,
|
||||
) -> Option<FighterState> {
|
||||
fn check_interrupt(&self, state_context: &FighterStateContext) -> Option<FighterState> {
|
||||
None
|
||||
}
|
||||
|
||||
|
||||
fn on_enter(&mut self, _state_context: &mut super::FighterStateContext) {}
|
||||
|
||||
|
||||
fn update(&mut self, state_context: &mut super::FighterStateContext) {
|
||||
air::integrate_gravity(state_context.velocity, state_context.fighter_attribs);
|
||||
air::apply_air_motion(state_context.velocity, state_context.translation, state_context.prev_translation);
|
||||
air::apply_air_motion(
|
||||
state_context.velocity,
|
||||
state_context.translation,
|
||||
state_context.prev_translation,
|
||||
);
|
||||
}
|
||||
|
||||
fn check_collision_interrupt(
|
||||
@@ -35,9 +36,9 @@ impl FighterStateImpl for FallState {
|
||||
// Adjust translation
|
||||
state_context.translation.0 = res.hit_position - state_context.ecb.get_bottom_point();
|
||||
let grounded_common = GroundedStateCommon {
|
||||
current_line_id: res.line_id
|
||||
current_line_id: res.line_id,
|
||||
};
|
||||
Some(FighterState::Wait(WaitState { grounded_common } ))
|
||||
Some(FighterState::Wait(WaitState { grounded_common }))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -52,4 +53,3 @@ pub fn check_input(state_context: &FighterStateContext) -> Option<FighterState>
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user