Don't speak direction component when added.
This commit is contained in:
parent
24334ba511
commit
81162c8ca8
|
@ -197,12 +197,17 @@ 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() {
|
||||||
|
if !change.is_added() {
|
||||||
let direction: String = (*direction).into();
|
let direction: String = (*direction).into();
|
||||||
tts.speak(direction, true)?;
|
tts.speak(direction, true)?;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user