Fixes a bug where run sfx were being played during a roll.

This commit is contained in:
Shane Handley 2020-06-15 06:23:39 +10:00
parent 697c7d734a
commit 825cf98a00
3 changed files with 8 additions and 4 deletions

View File

@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Lanterns now stop glowing if you throw a lit one out of your inventory
- Fixed a crash caused by certain audio devices on OSX
- Bow animations now show held arrows
- Fixed a bug where walk/run sfx played while a character rolled/dodged
### Removed

View File

@ -149,16 +149,19 @@ impl MovementEventMapper {
previous_state: &PreviousEntityState,
vel: Vec3<f32>,
) -> SfxEvent {
// Match run state
// Match run / roll state
if physics_state.on_ground && vel.magnitude() > 0.1
|| !previous_state.on_ground && physics_state.on_ground
{
return SfxEvent::Run;
return if character_state.is_dodge() {
SfxEvent::Roll
} else {
SfxEvent::Run
};
}
// Match all other Movemement and Action states
match (previous_state.event, character_state) {
(_, CharacterState::Roll { .. }) => SfxEvent::Roll,
(_, CharacterState::Climb { .. }) => SfxEvent::Climb,
(SfxEvent::Glide, CharacterState::Idle { .. }) => SfxEvent::GliderClose,
(previous_event, CharacterState::Glide { .. }) => {

View File

@ -183,7 +183,7 @@ fn maps_roll() {
time: Instant::now(),
on_ground: true,
},
Vec3::zero(),
Vec3::new(0.5, 0.5, 0.0),
);
assert_eq!(result, SfxEvent::Roll);