first version of EU AI Act game
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
extends Node
|
||||
|
||||
var voice_id
|
||||
|
||||
func _ready():
|
||||
var voices = DisplayServer.tts_get_voices_for_language("de")
|
||||
if voices.size() > 0:
|
||||
voice_id = "German+Robosoft6"
|
||||
else:
|
||||
voices = DisplayServer.tts_get_voices_for_language("en")
|
||||
voice_id = voices[0]
|
||||
|
||||
# Connect with DialogueManager
|
||||
DialogueManager.got_dialogue.connect(_on_dialogue)
|
||||
|
||||
|
||||
func _on_dialogue(line):
|
||||
if voice_id == null:
|
||||
return
|
||||
|
||||
# Stop earlier text (important!)
|
||||
DisplayServer.tts_stop()
|
||||
|
||||
# Speak
|
||||
DisplayServer.tts_speak(line.text, voice_id, 100)
|
||||
|
||||
func _stop_dialogue():
|
||||
DisplayServer.tts_stop()
|
||||
Reference in New Issue
Block a user