Ajout d'audio de recherche

This commit is contained in:
Tipragot 2023-11-04 12:47:33 +01:00
parent df4d388d9e
commit cd0b3dee53
4 changed files with 14 additions and 2 deletions

View file

@ -0,0 +1,8 @@
[
"Alors, où te cache tu ???",
"Je vais te trouver !",
"Ou te cache tu ?",
"Mais t'es où enfin !",
"Comment cet idiot fait pour aussi bien se cacher ?",
"Montre toi..."
]

View file

@ -21,7 +21,7 @@ import pyttsx3
engine = pyttsx3.init() engine = pyttsx3.init()
def spawn_dialog(world: World, name: str, height: float = 900): def spawn_dialog(world: World, name: str, index: int = -1, height: float = 100):
""" """
Fait apparaitre un dialogue dans le monde. Fait apparaitre un dialogue dans le monde.
""" """
@ -29,7 +29,7 @@ def spawn_dialog(world: World, name: str, height: float = 900):
texts: list[str] = json.load( texts: list[str] = json.load(
open(f"assets/dialogs/{name}.json", "r", encoding="utf-8") open(f"assets/dialogs/{name}.json", "r", encoding="utf-8")
) )
text = random.choice(texts) text = random.choice(texts) if index == -1 else texts[index]
# engine.say(text) # engine.say(text)
engine.save_to_file(text, "voice.mp3") engine.save_to_file(text, "voice.mp3")
engine.runAndWait() engine.runAndWait()

View file

@ -177,9 +177,13 @@ def __game_loop(world: World):
La boucle principale de la scène La boucle principale de la scène
""" """
yield wait(5.0) yield wait(5.0)
dialog_index = 0
for i in range(10): for i in range(10):
if i % 2 == 1: if i % 2 == 1:
__block_directory(world) __block_directory(world)
if i in (0, 1, 2, 4, 6, 8):
dialog.spawn_dialog(world, "search", dialog_index)
dialog_index += 1
__spawn_search_alerts(world, int(i / 1.5) + 1) __spawn_search_alerts(world, int(i / 1.5) + 1)
yield wait(5.0 - (i * 0.4)) yield wait(5.0 - (i * 0.4))
__spawn_search_directory(world) __spawn_search_directory(world)

BIN
voice.mp3 Normal file

Binary file not shown.