54 lines
1.5 KiB
Rust
54 lines
1.5 KiB
Rust
use super::{CollisionContext, EnterContext, FighterStateImpl, InterruptContext, UpdateContext};
|
|
use crate::fighter::animation::AnimKind;
|
|
use crate::fighter::state::air::AirborneStateCommon;
|
|
use crate::fighter::state::{FighterState, air, jump};
|
|
|
|
#[derive(Debug, Clone, Copy, Hash, Default)]
|
|
pub struct FallState {
|
|
airborne_state_common: AirborneStateCommon
|
|
}
|
|
|
|
impl FallState {
|
|
pub fn new(airborne_state_common: AirborneStateCommon) -> Self {
|
|
Self {
|
|
airborne_state_common
|
|
}
|
|
}
|
|
}
|
|
|
|
impl FighterStateImpl for FallState {
|
|
const NAME: &'static str = "Fall";
|
|
|
|
fn check_interrupt(&self, state_context: &mut InterruptContext) -> Option<FighterState> {
|
|
jump::check_input_double_jump(state_context)
|
|
}
|
|
|
|
fn on_enter(&mut self, state_context: &mut EnterContext) {
|
|
state_context.play_animation(AnimKind::Fall, true);
|
|
}
|
|
|
|
fn update(&mut self, state_context: &mut UpdateContext) {
|
|
air::update_standard_motion(state_context, &mut self.airborne_state_common);
|
|
}
|
|
|
|
fn check_collision_interrupt(
|
|
&mut self,
|
|
state_context: &mut CollisionContext,
|
|
) -> Option<FighterState> {
|
|
air::collision_interrupt(
|
|
state_context,
|
|
crate::fighter::state::land::LandingType::Normal,
|
|
)
|
|
}
|
|
|
|
fn is_visually_grounded<'a>(
|
|
&'a self,
|
|
) -> bool {
|
|
false
|
|
}
|
|
|
|
fn surface_policy(&self) -> super::SurfacePolicy {
|
|
super::SurfacePolicy::Airborne(crate::fighter::surface::EcbLockPolicy::StartOnDetach)
|
|
}
|
|
}
|