make triple strike continue without hits again

This commit is contained in:
AdamWhitehurst 2020-03-27 07:03:26 -07:00
parent 0ffff86e25
commit c1647e93f1

View File

@ -51,7 +51,7 @@ impl CharacterBehavior for Data {
.unwrap_or(Duration::default()); .unwrap_or(Duration::default());
// If player stops holding input, don't go to the next stage // If player stops holding input, don't go to the next stage
let mut should_transition = data.inputs.primary.is_pressed() && self.should_transition; let should_transition = data.inputs.primary.is_pressed() && self.should_transition;
if !self.initialized { if !self.initialized {
update.vel.0 = Vec3::zero(); update.vel.0 = Vec3::zero();
@ -63,14 +63,9 @@ impl CharacterBehavior for Data {
// Handle hit applied // Handle hit applied
if let Some(attack) = data.attacking { if let Some(attack) = data.attacking {
if attack.applied { if attack.applied && attack.hit_count > 0 {
if attack.hit_count > 0 { // Take energy on successful hit
// Take energy on successful hit update.energy.change_by(100, EnergySource::HitEnemy);
update.energy.change_by(100, EnergySource::HitEnemy);
} else {
// Prevent transition on failure
should_transition = false;
}
// Always remove component // Always remove component
data.updater.remove::<Attacking>(data.entity); data.updater.remove::<Attacking>(data.entity);
} }