From 974de97ded59610c8daf005735b92d8c95fb7ca0 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 5 Apr 2024 20:28:53 +0200 Subject: [PATCH] play click SFX when targeting --- src/hud.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hud.rs b/src/hud.rs index 3123558..aeb79b6 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -598,7 +598,6 @@ fn handle_input( ew_togglemusic.send(audio::ToggleMusicEvent()); } if mouse_input.just_pressed(settings.key_selectobject) { - //ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Switch)); if q_target.is_empty() { if let Ok(camtrans) = q_camera.get_single() { let objects: Vec<(Entity, &Transform)> = q_objects @@ -607,12 +606,14 @@ fn handle_input( .collect(); if let (Some(entity), _dist) = camera::find_closest_target::(objects, camtrans) { commands.entity(entity).insert(IsTargeted); + ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Click)); } } } else { for entity in &q_target { commands.entity(entity).remove::(); + ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Click)); } } }