From 7b172058bb99cc3a987e5194bee5550f8a048353 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 1 Apr 2024 06:24:29 +0200 Subject: [PATCH] add adrenaline jolt on collisions --- src/actor.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/actor.rs b/src/actor.rs index d962963..484db25 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -564,11 +564,13 @@ fn handle_collisions( mut collision_event_reader: EventReader, mut ew_sfx: EventWriter, q_player: Query>, + mut q_player_lifeform: Query<&mut LifeForm, With>, ) { - if let Ok(player) = q_player.get_single() { + if let (Ok(player), Ok(mut lifeform)) = (q_player.get_single(), q_player_lifeform.get_single_mut()) { for CollisionStarted(entity1, entity2) in collision_event_reader.read() { if *entity1 == player || *entity2 == player { ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Crash)); + lifeform.adrenaline_jolt += 0.1; } } }