Energy now does not regen when climbing,gliding,and swimming

This commit is contained in:
Ben Simpson 2020-02-13 18:46:01 -06:00
parent 56c4b50a27
commit c427f2298e

View File

@ -1,5 +1,5 @@
use crate::{ use crate::{
comp::{ActionState, CharacterState, Energy, EnergySource, HealthSource, Stats}, comp::{ActionState, CharacterState, Energy, EnergySource, HealthSource, MovementState, Stats},
event::{EventBus, ServerEvent}, event::{EventBus, ServerEvent},
state::DeltaTime, state::DeltaTime,
}; };
@ -97,6 +97,27 @@ impl<'a> System<'a> for Sys {
} }
}, },
} }
match character_state.movement {
MovementState::Climb => {
if energy.get_unchecked().regen_rate != 0.0 {
energy.get_mut_unchecked().regen_rate = 0.0
}
},
MovementState::Glide => {
if energy.get_unchecked().regen_rate != 0.0 {
energy.get_mut_unchecked().regen_rate = 0.0
}
},
MovementState::Swim => {
if energy.get_unchecked().regen_rate != 0.0 {
energy.get_mut_unchecked().regen_rate = 0.0
}
},
_ => {
continue;
},
}
} }
} }
} }