Tree("Root") { Composite(Sequence) { BTC.InitializeSpeechManager() BTC.SetSpeechRecognitionLanguage("it-IT") BTC.SetVoiceName("it-IT-FabiolaNeural") Composite(Race) { Composite(Sequence) { // Error in Speech Service: Cancel BTC Trees BTC.SpeechErrorOccured() BTC.SetBool("error") } Composite(Sequence) { RunTree("22_Geschaeft_Story_A_Picknicken_Intro") //RunTree("22_Geschaeft_Baeckerei_Outro") } } Composite(Sequence) { BTC.CompareBool("error") // Error Handling BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() BTC.Show("GO.HANDMENU.SpeechButton") BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "Restart") BTC.Show("GO.HANDMENU.Option1Button") BTC.Run("NamedEventTrigger.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Show("GO.HANDMENU.Home") BTC.Hide("GO.HANDMENU.SpeechOptions") } } } Tree("22_Geschaeft_Story_A_Picknicken_Intro") { Composite(Sequence) { BTC.SynthesizeText("Qui trovi i migliori panini di tutta Bellinzona. Mhmmm, adoro fare i picnic!") BTC.SpeechOutputEnded() BTC.SynthesizeText("Anche le piadine di Pietro sono deliziose. Mhmm, cosa prendo? Tu ordina pure, io devo ancora pensarci un momento.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Ciao Francesca! Come posso servirvi?") BTC.SpeechOutputEnded() BTC.AddPossbileSpeechIntent("Story_A_Picknicken.Intro.3") 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() } } RunTree("22_Geschaeft_Story_A_Picknicken_Mitnehmen") } // -- Race 2: User sagt nichts Composite(Sequence) { BTC.Wait(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() // --- Story A Picknicken - Nachfrage Bestellung --- BTC.SynthesizeText("Sa già cosa prendere?") BTC.SpeechOutputEnded() BTC.AddPossbileSpeechIntent("Story_A_Picknicken.Nachfrage_Bestellung.2") 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() } } RunTree("22_Geschaeft_Story_A_Picknicken_Mitnehmen") } // -- Race 2: User sagt nichts Composite(Sequence) { BTC.Wait(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() // --- Story A Picknicken - Bestellung Begleiter Beide --- BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Dai, se vuoi ordino io per tutt’e due, va bene?") BTC.SpeechOutputEnded() BTC.SynthesizeText("Vorrei due panini al formaggio, due piadine alla caprese e due gazzose al mandarino.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Con piacere. Da portare via o da mangiare qui?") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Da portare via, per favore.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Fanno 42 franchi. Paghi col cellulare? Per favore, avvicinalo al dispositivo.") BTC.SpeechOutputEnded() BTC.SynthesizeText("Grazie mille! Divertitevi!") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Grazie, Pietro. A presto.") BTC.SpeechOutputEnded() RunTree("22_Geschaeft_Baeckerei_Outro") } } } // erste Race user sagt nichts } // erste grosse race } } Tree("22_Geschaeft_Story_A_Picknicken_Mitnehmen") { // --- Story A Picknicken - Mitnehmen --- Composite(Sequence) { BTC.SynthesizeText("Volentieri. Da portare via o da mangiare qui?") BTC.SpeechOutputEnded() BTC.AddPossbileSpeechIntent("Story_A_Picknicken.Mitnehmen.2") 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(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() } } BTC.SynthesizeText("Allora le incarto tutto.") BTC.SpeechOutputEnded() // --- Story A Picknicken - Bezahlen einzeln --- BTC.SynthesizeText("Fanno 21 franchi. Per favore, paghi avvicinando il telefono al dispositivo.") BTC.SpeechOutputEnded() // ToDo: Bezahlung mit Handy User Composite(Race) { // ToDo: Collide handy mit Payment device BTC.GetKeyDown("Return") Composite(Sequence) { BTC.Wait(5) // Collide Aktion abbrechen? // --- Story A Picknicken - Nachfrage Bezahlung --- BTC.SynthesizeText("Per favore, avvicini il cellulare qui, al dispositivo.") BTC.SpeechOutputEnded() Composite(Race) { // ToDo: Collide handy mit Payment device BTC.GetKeyDown("Return") Composite(Sequence) { BTC.Wait(5) // Collide aktion abbrechen? BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Ok, pago io per te, puoi darmi i soldi più tardi.") BTC.SpeechOutputEnded() } } } } // --- Story A Picknicken - Dank Einkauf --- BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Tante grazie! Divertitevi!") BTC.SpeechOutputEnded() BTC.AddPossbileSpeechIntent("Story_A_Picknicken.Dank_Einkauf.2") 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(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() } } // --- Story A Picknicken - Bestellung Begleiter --- BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Ecco, finalmente so cosa prendere. Vorrei un panino al formaggio e una piadina con prosciutto di Parma, per favore.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Metto tutto nello stesso sacchetto?") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Si si, va bene.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("E qualcosa da bere?") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Ah sì, una gazzosa al mandarino, per favore.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Allora, sono 25 franchi.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Pago col cellulare.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Per piacere paga attraverso il dispositivo.") BTC.SpeechOutputEnded() BTC.SynthesizeText("Grazie mille!") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Anche a te Pietro, a presto!") BTC.SpeechOutputEnded() RunTree("22_Geschaeft_Baeckerei_Outro") } } Tree("22_Geschaeft_Baeckerei_Outro") { // --- Baeckerei Outro --- Composite(Sequence) { BTC.Run("StudioEventEmitter.STATIC.TuerOeffnenSound") BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Ehi, Enrico, che coincidenza!") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Ciao Francesca, ti ho visto da fuori. Che piacere vederti!") BTC.SpeechOutputEnded() BTC.SynthesizeText("Vedo che avete grandi progetti per oggi!") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Ti presento qualcuno, è di passaggio e viene dalla Svizzera tedesca.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Ciao, piacere di conoscerti. Sono Enrico. Come ti chiami?") BTC.SpeechOutputEnded() BTC.AddPossbileSpeechIntent("Baeckerei_Outro.6") 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(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() } } BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Stiamo andando a fare un picnic. Perché non vieni con noi?") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Mi piacerebbe, ma sto andando ad allenarmi.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Ah, ok, io tornerò la settimana prossima.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Be’, allora divertitevi! Ehi, è stato bello vederti!") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Anche per me, ciao Enrico!") BTC.SpeechOutputEnded() BTC.SynthesizeText("È un mio amico. Ci siamo conosciuti frequentando il gruppo di arrampicata. Davvero un grande amico! Dai, ora cerchiamo un bel posticino per rilassarci un po’. Andiamo a piedi o preferisci andare in monopattino? Non è lontano, sai. Da qui, a piedi impieghiamo una ventina di minuti.") BTC.SpeechOutputEnded() BTC.AddPossbileSpeechIntent("Baeckerei_Outro.16") BTC.AddPossbileSpeechIntent("Baeckerei_Outro.18") BTC.StartSpeechIntentRecognition() Composite(Race) { // -- Race 1: User sagt etwas Composite(Sequence) { BTC.UserStartedSpeechInput() Composite(Selector) { // -- Selector 1: Intent erkannt Composite(Sequence) { BTC.SpeechIntentRecognized() Composite(Race) { Composite(Sequence) { BTC.CompareIntentID("Baeckerei_Outro.16") BTC.SetBool("ChoosedWalking") } Composite(Sequence) { BTC.CompareIntentID("Baeckerei_Outro.18") BTC.SetBool("ChoosedDriving") } } BTC.ClearPossbileSpeechIntents() } // -- Selector 2: Intent nicht erkannt Composite(Sequence) { BTC.SynthesizeText("Allora, in monopattino o a piedi?") BTC.SpeechOutputEnded() BTC.StartSpeechIntentRecognition() Composite(Race) { Composite(Sequence) { BTC.UserStartedSpeechInput() BTC.SpeechIntentRecognized() Composite(Race) { Composite(Sequence) { BTC.CompareIntentID("Baeckerei_Outro.16") BTC.SetBool("ChoosedWalking") } Composite(Sequence) { BTC.CompareIntentID("Baeckerei_Outro.18") BTC.SetBool("ChoosedDriving") } } BTC.ClearPossbileSpeechIntents() } Composite(Sequence) { BTC.Wait(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() BTC.CompareUserSpeechInputStarted(true) } } } // Selector 3: Fallback Button Composite(Sequence) { Composite(Marathon) { BTC.Show("GO.HANDMENU.SpeechOptions") BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "A piedi") BTC.Show("GO.HANDMENU.Option1Button") BTC.Set("TextMeshPro.HANDMENU.Option2Button", "text", "Monopattino") BTC.Show("GO.HANDMENU.Option2Button") } Composite(Race) { Composite(Sequence) { // Zu Fuss BTC.Run("NamedEventTrigger.HANDMENU.Option1Button") BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Show("GO.HANDMENU.Home") BTC.Hide("GO.HANDMENU.SpeechOptions") BTC.SetBool("ChoosedWalking") } Composite(Sequence) { // Scooter BTC.Run("NamedEventTrigger.HANDMENU.Option2Button") BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Show("GO.HANDMENU.Home") BTC.Hide("GO.HANDMENU.SpeechOptions") BTC.SetBool("ChoosedDriving") } } } } } // -- Race 2: User sagt nichts Composite(Sequence) { BTC.Wait(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() Composite(Marathon) { BTC.Show("GO.HANDMENU.SpeechButton") BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "A piedi") BTC.Show("GO.HANDMENU.Option1Button") BTC.Set("TextMeshPro.HANDMENU.Option2Button", "text", "Monopattino") BTC.Show("GO.HANDMENU.Option2Button") } Composite(Race) { Composite(Sequence) { // Zu Fuss BTC.Run("NamedEventTrigger.HANDMENU.Option1Button") BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Show("GO.HANDMENU.Home") BTC.Hide("GO.HANDMENU.SpeechOptions") BTC.SetBool("ChoosedWalking") } Composite(Sequence) { // Scooter BTC.Run("NamedEventTrigger.HANDMENU.Option2Button") BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Show("GO.HANDMENU.Home") BTC.Hide("GO.HANDMENU.SpeechOptions") BTC.SetBool("ChoosedDriving") } } } } BTC.SynthesizeText("Allora andiamo! Ciao Pietro.") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Hey Francesca, non dimenticare il vostro pranzo!") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SynthesizeText("Uh, grazie mille!") BTC.SpeechOutputEnded() BTC.SetVoiceName("it-IT-GiuseppeMultilingualNeural") BTC.SynthesizeText("Ciao Francesca, divertitevi!") BTC.SpeechOutputEnded() RunTree("22_Geschaeft_Hide") } } Tree("22_Geschaeft_Hide") { Composite(Sequence) { BTC.SetStoryAVisited() Composite(Race) { Composite(Sequence) { // Go to scene 2.4 Slideshow BTC.CompareBool("ChoosedWalking") BTC.Run("LoadScene.NEXT.24Slideshow") } Composite(Sequence) { // Go to scene 2.5 Slideshow BTC.CompareBool("ChoosedDriving") BTC.Run("LoadScene.NEXT.25Slideshow") } } } }