Don't speak direction component when added.
This commit is contained in:
parent
24334ba511
commit
81162c8ca8
|
@ -197,11 +197,16 @@ fn update_direction(
|
||||||
|
|
||||||
fn speak_direction(
|
fn speak_direction(
|
||||||
mut tts: ResMut<Tts>,
|
mut tts: ResMut<Tts>,
|
||||||
player: Query<&CardinalDirection, (With<Player>, Changed<CardinalDirection>)>,
|
player: Query<
|
||||||
|
(&CardinalDirection, ChangeTrackers<CardinalDirection>),
|
||||||
|
(With<Player>, Changed<CardinalDirection>),
|
||||||
|
>,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
if let Ok(direction) = player.get_single() {
|
if let Ok((direction, change)) = player.get_single() {
|
||||||
let direction: String = (*direction).into();
|
if !change.is_added() {
|
||||||
tts.speak(direction, true)?;
|
let direction: String = (*direction).into();
|
||||||
|
tts.speak(direction, true)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user