allow Agent.speak() to override a previous call to speak()

This commit is contained in:
Lily Tsuru 2024-07-10 07:28:14 -04:00
parent 396ef67c78
commit d089018082

View file

@ -265,11 +265,13 @@ export class Agent {
} }
speak(text: string) { speak(text: string) {
if (this.wordballoonState == null) { if (this.wordballoonState != null) {
this.wordballoonState = new AgentWordBalloonState(this, text); this.stopSpeaking();
this.wordballoonState.positionUpdated();
this.wordballoonState.show();
} }
this.wordballoonState = new AgentWordBalloonState(this, text);
this.wordballoonState.positionUpdated();
this.wordballoonState.show();
} }
stopSpeaking() { stopSpeaking() {