Add option check.
This commit is contained in:
parent
1022037efe
commit
a26cf344d6
|
@ -101,10 +101,13 @@ fn update<S>(
|
||||||
for visible in viewers.iter() {
|
for visible in viewers.iter() {
|
||||||
for (icon_entity, mut icon, visibility, parent, mut sound) in icons.iter_mut() {
|
for (icon_entity, mut icon, visibility, parent, mut sound) in icons.iter_mut() {
|
||||||
let entity = if visibility.is_some() {
|
let entity = if visibility.is_some() {
|
||||||
icon_entity
|
Some(icon_entity)
|
||||||
|
} else if parent.is_some() {
|
||||||
|
Some(**parent.unwrap())
|
||||||
} else {
|
} else {
|
||||||
**parent.unwrap()
|
None
|
||||||
};
|
};
|
||||||
|
if let Some(entity) = entity {
|
||||||
if visible.contains(&entity) {
|
if visible.contains(&entity) {
|
||||||
let looping = sound.looping;
|
let looping = sound.looping;
|
||||||
if looping {
|
if looping {
|
||||||
|
@ -126,6 +129,7 @@ fn update<S>(
|
||||||
sound.reference_distance = icon.reference_distance;
|
sound.reference_distance = icon.reference_distance;
|
||||||
sound.max_distance = icon.max_distance;
|
sound.max_distance = icon.max_distance;
|
||||||
sound.rolloff_factor = icon.rolloff_factor;
|
sound.rolloff_factor = icon.rolloff_factor;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sound.state = SoundState::Stopped;
|
sound.state = SoundState::Stopped;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user