Reviewed-on: #30 Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #30.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
use super::{FighterStateContext, FighterStateImpl, dash, ground, wait};
|
||||
use super::{
|
||||
CollisionContext, EnterContext, FighterStateImpl, InterruptContext, UpdateContext, dash,
|
||||
ground, wait,
|
||||
};
|
||||
use crate::fighter::animation::AnimKind;
|
||||
use crate::fighter::state::FighterState;
|
||||
use crate::fighter::state::fall::FallState;
|
||||
@@ -11,7 +14,7 @@ pub struct WalkState {
|
||||
|
||||
impl FighterStateImpl for WalkState {
|
||||
const NAME: &'static str = "Walk";
|
||||
fn check_interrupt(&self, state_context: &mut FighterStateContext) -> Option<FighterState> {
|
||||
fn check_interrupt(&self, state_context: &mut InterruptContext) -> Option<FighterState> {
|
||||
if let Some(state) =
|
||||
ground::grounded_movement_common_interrupts(state_context, &self.grounded_common)
|
||||
{
|
||||
@@ -21,22 +24,21 @@ impl FighterStateImpl for WalkState {
|
||||
.or_else(|| dash::check_input(state_context, &self.grounded_common))
|
||||
}
|
||||
|
||||
fn on_enter(&mut self, state_context: &mut FighterStateContext) {
|
||||
fn on_enter(&mut self, state_context: &mut EnterContext) {
|
||||
state_context.play_animation(AnimKind::Walk, true);
|
||||
}
|
||||
|
||||
fn update(&mut self, state_context: &mut FighterStateContext) {
|
||||
fn update(&mut self, state_context: &mut UpdateContext) {
|
||||
let last_frame = state_context.input.get_last_frame();
|
||||
let (accel, target_vel) = state_context
|
||||
.fighter_manifest
|
||||
.attributes
|
||||
.fighter_attributes
|
||||
.get_accel_and_target_walk(&last_frame);
|
||||
|
||||
let accel = ground::compute_ground_accel(
|
||||
accel,
|
||||
target_vel,
|
||||
state_context.velocity.x,
|
||||
&state_context.fighter_manifest.attributes,
|
||||
state_context.fighter_attributes,
|
||||
&state_context.game_settings,
|
||||
);
|
||||
|
||||
@@ -51,7 +53,7 @@ impl FighterStateImpl for WalkState {
|
||||
|
||||
fn check_collision_interrupt(
|
||||
&mut self,
|
||||
state_context: &mut FighterStateContext,
|
||||
state_context: &mut CollisionContext,
|
||||
) -> Option<FighterState> {
|
||||
if let GroundedMotionResult::InAir =
|
||||
ground::collide_with_stage_grounded(state_context, &mut self.grounded_common, false)
|
||||
@@ -64,7 +66,7 @@ impl FighterStateImpl for WalkState {
|
||||
}
|
||||
|
||||
pub fn check_input(
|
||||
state_context: &FighterStateContext,
|
||||
state_context: &InterruptContext,
|
||||
ground_state_common: &GroundedStateCommon,
|
||||
) -> Option<FighterState> {
|
||||
let input_frame = state_context.input.get_last_frame();
|
||||
|
||||
Reference in New Issue
Block a user