Fixed consecutive strikes carrying animation over

This commit is contained in:
Sam 2022-05-11 22:10:07 -04:00
parent c4987c3c48
commit 4f2b1d37f8

View File

@ -25,7 +25,7 @@ impl Animation for ComboAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_combo")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(hands, ability_id, stage_section, ability_info, strike): Self::Dependency<'a>,
(hands, ability_id, stage_section, ability_info, current_strike): Self::Dependency<'a>,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -33,31 +33,32 @@ impl Animation for ComboAnimation {
*rate = 1.0;
let mut next = (*skeleton).clone();
for i in 0..=strike {
let (move1, move2, move3, _move2h) = if i == strike { match stage_section {
for strike in 0..=current_strike {
let (move1, move2, move3, _move2h) = if strike == current_strike {
match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25)),
Some(StageSection::Action) => {
(1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25))
},
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
}} else {
}
} else {
(1.0, 1.0, 1.0, 1.0)
};
let pullback = 1.0 - move3;
let move2 = move2 * pullback;
match ability_id {
Some("common.abilities.sword.balanced_combo") => {
match strike {
Some("common.abilities.sword.balanced_combo") => match strike {
0 => {
next.head.orientation = Quaternion::rotation_x(move1 * 5.0);
next.head.orientation = Quaternion::rotation_x(move1);
},
1 => {
next.head.orientation = Quaternion::rotation_z(move1 * 5.0);
next.head.orientation.rotate_z(move1);
},
_ => {},
}
},
_ => {
match strike {
_ => match strike {
0 => {
let (move1, move2, move3, move2h) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
@ -751,7 +752,6 @@ impl Animation for ComboAnimation {
}
},
_ => {},
}
},
}
}