play click SFX when targeting
This commit is contained in:
parent
9694ebfecd
commit
974de97ded
|
@ -598,7 +598,6 @@ fn handle_input(
|
||||||
ew_togglemusic.send(audio::ToggleMusicEvent());
|
ew_togglemusic.send(audio::ToggleMusicEvent());
|
||||||
}
|
}
|
||||||
if mouse_input.just_pressed(settings.key_selectobject) {
|
if mouse_input.just_pressed(settings.key_selectobject) {
|
||||||
//ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Switch));
|
|
||||||
if q_target.is_empty() {
|
if q_target.is_empty() {
|
||||||
if let Ok(camtrans) = q_camera.get_single() {
|
if let Ok(camtrans) = q_camera.get_single() {
|
||||||
let objects: Vec<(Entity, &Transform)> = q_objects
|
let objects: Vec<(Entity, &Transform)> = q_objects
|
||||||
|
@ -607,12 +606,14 @@ fn handle_input(
|
||||||
.collect();
|
.collect();
|
||||||
if let (Some(entity), _dist) = camera::find_closest_target::<Entity>(objects, camtrans) {
|
if let (Some(entity), _dist) = camera::find_closest_target::<Entity>(objects, camtrans) {
|
||||||
commands.entity(entity).insert(IsTargeted);
|
commands.entity(entity).insert(IsTargeted);
|
||||||
|
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Click));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for entity in &q_target {
|
for entity in &q_target {
|
||||||
commands.entity(entity).remove::<IsTargeted>();
|
commands.entity(entity).remove::<IsTargeted>();
|
||||||
|
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Click));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue