UP-Viagg-io/Viagg-io/Assets/BehaviourTrees/3.2-Grotto-Zwischenversion....

299 lines
11 KiB
Plaintext
Raw Normal View History

2024-11-11 18:50:07 +01:00
Tree("Root") {
Composite(Sequence) {
BTC.InitializeSpeechManager()
2024-11-19 21:45:47 +01:00
//BTC.SetSpeechRecognitionLanguage("it-IT")
BTC.Wait(5)
BTC.SynthesizeText("Gib mir Bescheid, sobald du bereit bist.")
BTC.SpeechOutputEnded()
BTC.SetBool("startdialogue", false)
Composite(Race) {
Decorator(Repeat) {
Composite(Sequence) {
BTC.Wait(15)
// Race mit Sprache und Wait
BTC.SynthesizeText("Gib mir Bescheid, sobald du bereit bist.")
BTC.SpeechOutputEnded()
}
}
BTC.CompareBool("startdialogue", true)
}
BTC.SynthesizeText("Wir beide werden jetzt ein feines Risotto nach dem Rezept meiner Nonna kochen. Kochst du denn gerne?")
2024-11-19 21:45:47 +01:00
//BTC.SynthesizeText("Noi due adesso facciamo un buon risotto basato sulla ricetta di mia nonna. Ti piace cucinare?")
2024-11-11 18:50:07 +01:00
BTC.SpeechOutputEnded()
// Frage beantworten
BTC.AddPossbileSpeechIntent("Kueche.alles_gefunden.4")
BTC.AddPossbileSpeechIntent("Kueche.alles_gefunden.6")
2024-11-11 18:50:07 +01:00
BTC.StartSpeechIntentRecognition()
Composite(Race) {
// -- Race 1: User sagt etwas
Composite(Sequence) {
BTC.UserStartedSpeechInput()
Composite(Selector) {
// -- Selector 1: Intent erkannt
Composite(Sequence) {
BTC.SpeechIntentRecognized()
// Intent erkannt
Composite(Race) {
Composite(Sequence) {
BTC.CompareIntentID("Kueche.alles_gefunden.4")
BTC.ClearPossbileSpeechIntents()
RunTree("32_Grotto_Kueche_Interesse_Kochen")
}
Composite(Sequence) {
BTC.CompareIntentID("Kueche.alles_gefunden.6")
BTC.ClearPossbileSpeechIntents()
RunTree("32_Grotto_Kueche_Desinteresse_Kochen")
}
}
}
// -- Selector 2: Intent nicht erkannt
Composite(Sequence) {
BTC.ClearPossbileSpeechIntents()
// Fallback Button
Composite(Marathon) {
BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "Ja")
BTC.Show("GO.HANDMENU.Option1Button")
BTC.Set("TextMeshPro.HANDMENU.Option2Button", "text", "Nein")
BTC.Show("GO.HANDMENU.Option2Button")
}
Composite(Race) {
Composite(Sequence) {
// Ja
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
RunTree("32_Grotto_Kueche_Interesse_Kochen")
}
Composite(Sequence) {
// Nein
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
RunTree("32_Grotto_Kueche_Desinteresse_Kochen")
}
}
}
}
}
// -- Race 2: User sagt nichts
Composite(Sequence) {
BTC.Wait(10)
BTC.CompareUserSpeechInputStarted(false)
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Fallback Button
Composite(Marathon) {
BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "Ja")
BTC.Show("GO.HANDMENU.Option1Button")
BTC.Set("TextMeshPro.HANDMENU.Option2Button", "text", "Nein")
BTC.Show("GO.HANDMENU.Option2Button")
}
Composite(Race) {
Composite(Sequence) {
// Ja
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
RunTree("32_Grotto_Kueche_Interesse_Kochen")
}
Composite(Sequence) {
// Nein
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
RunTree("32_Grotto_Kueche_Desinteresse_Kochen")
}
}
}
}
}
}
Tree("32_Grotto_Kueche_Interesse_Kochen") {
// --- Kueche - Interesse Kochen ---
Composite(Sequence) {
BTC.SynthesizeText("Was kochst du denn manchmal so?")
2024-11-19 21:45:47 +01:00
//BTC.SynthesizeText("Cosa ti piace cucinare?")
2024-11-11 18:50:07 +01:00
BTC.SpeechOutputEnded()
// Frage beantworten
BTC.AddPossbileSpeechIntent("Kueche.Interesse_Kochen.2")
2024-11-11 18:50:07 +01:00
BTC.StartSpeechIntentRecognition()
Composite(Race) {
// -- Race 1: User sagt etwas
Composite(Sequence) {
BTC.UserStartedSpeechInput()
Composite(Selector) {
// -- Selector 1: Intent erkannt
Composite(Sequence) {
BTC.SpeechIntentRecognized()
BTC.ClearPossbileSpeechIntents()
}
// -- Selector 2: Intent nicht erkannt
Composite(Sequence) {
BTC.ClearPossbileSpeechIntents()
}
}
}
// -- Race 2: User sagt nichts
Composite(Sequence) {
BTC.Wait(10)
BTC.CompareUserSpeechInputStarted(false)
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
}
}
RunTree("32_Grotto_Kueche_Kochen_Anzahl")
}
}
Tree("32_Grotto_Kueche_Kochen_Anzahl") {
// --- Kueche - Kochen Anzahl ---
Composite(Sequence) {
BTC.SynthesizeText("Ja, das mag ich auch gerne. Wie oft kochst du denn so?")
2024-11-19 21:45:47 +01:00
//BTC.SynthesizeText("Sì, questo piace anche a me. Cucini spesso?")
2024-11-11 18:50:07 +01:00
BTC.SpeechOutputEnded()
// Frage beantworten
BTC.AddPossbileSpeechIntent("Kueche.Kochen_Anzahl.2")
BTC.AddPossbileSpeechIntent("Kueche.Kochen_Anzahl.4")
2024-11-11 18:50:07 +01:00
BTC.StartSpeechIntentRecognition()
Composite(Race) {
// -- Race 1: User sagt etwas
Composite(Sequence) {
BTC.UserStartedSpeechInput()
Composite(Selector) {
// -- Selector 1: Intent erkannt
Composite(Sequence) {
BTC.SpeechIntentRecognized()
BTC.ClearPossbileSpeechIntents()
}
// -- Selector 2: Intent nicht erkannt
Composite(Sequence) {
BTC.ClearPossbileSpeechIntents()
}
}
}
// -- Race 2: User sagt nichts
Composite(Sequence) {
BTC.Wait(10)
BTC.CompareUserSpeechInputStarted(false)
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
}
}
RunTree("32_Grotto_Kueche_Interaktion")
}
}
Tree("32_Grotto_Kueche_Desinteresse_Kochen") {
// --- Kueche - Desinteresse Kochen ---
Composite(Sequence) {
2024-11-19 21:45:47 +01:00
BTC.SynthesizeText("Okay, aber heute kochen wir gemeinsam und das Risotto ist auch nicht allzu schwer. Was ist denn dein Lieblingsgericht?")
//BTC.SynthesizeText("Okay, ma oggi cuciniamo insieme. Fare un risotto non è complicato. Qual è il tuo piatto preferito?")
2024-11-11 18:50:07 +01:00
BTC.SpeechOutputEnded()
// Lieblingsgericht beantworten
BTC.AddPossbileSpeechIntent("Kueche.Desinteresse_Kochen.2")
2024-11-11 18:50:07 +01:00
BTC.StartSpeechIntentRecognition()
Composite(Race) {
// -- Race 1: User sagt etwas
Composite(Sequence) {
BTC.UserStartedSpeechInput()
Composite(Selector) {
// -- Selector 1: Intent erkannt
Composite(Sequence) {
BTC.SpeechIntentRecognized()
BTC.ClearPossbileSpeechIntents()
}
// -- Selector 2: Intent nicht erkannt
Composite(Sequence) {
BTC.ClearPossbileSpeechIntents()
}
}
}
// -- Race 2: User sagt nichts
Composite(Sequence) {
BTC.Wait(10)
BTC.CompareUserSpeechInputStarted(false)
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
}
}
BTC.SynthesizeText("Ja, das mag ich auch gerne.")
2024-11-19 21:45:47 +01:00
//BTC.SynthesizeText("Sì, questo piace anche a me.")
2024-11-11 18:50:07 +01:00
BTC.SpeechOutputEnded()
RunTree("32_Grotto_Kueche_Interaktion")
}
}
Tree("32_Grotto_Kueche_Interaktion") {
Composite(Sequence) {
2024-11-19 21:45:47 +01:00
BTC.SynthesizeText("Gut, dann fangen wir jetzt mit dem Risotto an. Gebe bitte die Pilze in den Topf.")
//BTC.SynthesizeText("Bene, allora cominciamo con il risotto. Versa le cipolle e il riso nella pentola.")
2024-11-11 18:50:07 +01:00
BTC.SpeechOutputEnded()
2024-11-19 21:45:47 +01:00
BTC.Enable("NamedOutline.INTERACTABLES.Teller")
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Steinpilze")
Composite(Marathon) {
Composite(Sequence) {
BTC.Run("NamedGrabEvent.INTERACTABLES.Pilz01")
BTC.Run("Collider.INTERACTABLES.Topf")
}
Composite(Sequence) {
BTC.Run("NamedGrabEvent.INTERACTABLES.Pilz02")
BTC.Run("Collider.INTERACTABLES.Topf")
}
Composite(Sequence) {
BTC.Run("NamedGrabEvent.INTERACTABLES.Pilz03")
BTC.Run("Collider.INTERACTABLES.Topf")
}
}
2024-11-11 18:50:07 +01:00
2024-11-19 21:45:47 +01:00
BTC.Disable("NamedOutline.INTERACTABLES.Teller")
BTC.Wait(300)
2024-11-11 18:50:07 +01:00
}
}