add adrenaline jolt on collisions

This commit is contained in:
yuni 2024-04-01 06:24:29 +02:00
parent 04385530ae
commit 7b172058bb

View file

@ -564,11 +564,13 @@ fn handle_collisions(
mut collision_event_reader: EventReader<CollisionStarted>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
q_player: Query<Entity, With<PlayerCamera>>,
mut q_player_lifeform: Query<&mut LifeForm, With<Player>>,
) {
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;
}
}
}