Tree("Root") { Composite(Sequence) { BTC.InitializeSpeechManager() BTC.SetSpeechRecognitionLanguage("it-IT") BTC.SetVoiceName("it-IT-IsabellaMultilingualNeural") Composite(Race) { Composite(Sequence) { // Error in Speech Service: Cancel BTC Trees BTC.SpeechErrorOccured() BTC.SetBool("error") } Composite(Selector) { Composite(Sequence) { // Check Minigame SBB BTC.CheckEntryLevel(0) BTC.Run("MediaPlayer.VIDEOS.IntroFidle1") BTC.ResetEntryLevel(0) BTC.FadeIn("FadeScene.XRInteractionHandsSetup.Black") RunTree("10_SBB_Zugabteil_Szenenwahl") } Composite(Sequence) { BTC.Run("MediaPlayer.VIDEOS.IntroFidle1") BTC.FadeIn("FadeScene.XRInteractionHandsSetup.Black") RunTree("10_SBB_Zugabteil_Intro") } } } Composite(Sequence) { BTC.CompareBool("error") // Error Handling BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() Composite(Marathon) { BTC.Hide("GO.HINTS.SpeakHint") BTC.Hide("GO.HINTS.SitDownHint") BTC.Hide("GO.HINTS.StandUpHint") } Composite(Selector) { Composite(Sequence) { BTC.CompareSpeechError("Rate limit is exceeded") Composite(Marathon) { BTC.Set("TextMeshPro.HINTS.SpeechErrorTitle", "text", "Hold on") BTC.Set("TextMeshPro.HINTS.SpeechErrorText", "text", "Der SpeechService ist momentan nicht\nverfügbar. In 30 Sekunden geht es weiter.") BTC.Show("GO.HINTS.SpeechErrorHint") } BTC.Wait(30) } Composite(Sequence) { Composite(Marathon) { BTC.Set("TextMeshPro.HINTS.SpeechErrorTitle", "text", "Fehler") BTC.Set("TextMeshPro.HINTS.SpeechErrorText", "text", "Es besteht ein Problem mit der Internetverbindung.\nBringe das VR Headset bitte zu deiner Lehrperson.") BTC.Show("GO.HINTS.SpeechErrorHint") } Decorator(Repeat) { BTC.Wait(60) } } } } } } Tree("10_SBB_Zugabteil_Intro") { // --- Zugabteil - Intro --- Composite(Selector) { Composite(Sequence) { BTC.NoStoriesVisited() BTC.Wait(8) BTC.Hide("MediaPlayer.VIDEOS.IntroFidle1") // --- Zugabteil - Exposition --- BTC.Run("MediaPlayer.VIDEOS.ExpositionF1") BTC.Run("MediaPlayer.VIDEOS.ExpositionFidle2") BTC.AddPossbileSpeechIntent("Zugabteil-Exposition-U-2") BTC.StartSpeechIntentRecognition() BTC.Show("GO.HINTS.SpeakHint") Composite(Race) { // -- Race 1: User sagt etwas Composite(Sequence) { BTC.UserStartedSpeechInput() BTC.Hide("GO.HINTS.SpeakHint") 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.Hide("GO.HINTS.SpeakHint") } } BTC.Hide("MediaPlayer.VIDEOS.ExpositionFidle2") BTC.Run("MediaPlayer.VIDEOS.ExpositionF3") BTC.Run("MediaPlayer.VIDEOS.ExpositionFidle4") BTC.AddPossbileSpeechIntent("Zugabteil-Exposition-U-4a") BTC.AddPossbileSpeechIntent("Zugabteil-Exposition-U-4b") BTC.StartSpeechIntentRecognition() BTC.Show("GO.HINTS.SpeakHint") Composite(Race) { // -- Race 1: User sagt etwas Composite(Sequence) { BTC.UserStartedSpeechInput() BTC.Hide("GO.HINTS.SpeakHint") Composite(Selector) { // -- Selector 1: Intent erkannt Composite(Sequence) { BTC.SpeechIntentRecognized() // Intent erkannt Composite(Race) { Composite(Sequence) { BTC.CompareIntentID("Zugabteil-Exposition-U-4a") BTC.ClearPossbileSpeechIntents() // Load Scene: Story A Picknicken //BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.20SBB") } Composite(Sequence) { BTC.CompareIntentID("Zugabteil-Exposition-U-4b") BTC.ClearPossbileSpeechIntents() // Load Scene: Story B Grotto //BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.30SBB") } } } // -- Selector 2: Intent nicht erkannt Composite(Sequence) { BTC.ClearPossbileSpeechIntents() BTC.Hide("MediaPlayer.VIDEOS.ExpositionFidle4") RunTree("10_SBB_Zugabteil_Szenenwahl") } } } // -- Race 2: User sagt nichts Composite(Sequence) { BTC.Wait(5) BTC.CompareUserSpeechInputStarted(false) BTC.AbortSpeechEventListener() BTC.StopSpeechIntentRecognition() BTC.ClearPossbileSpeechIntents() BTC.Hide("MediaPlayer.VIDEOS.ExpositionFidle4") BTC.Hide("GO.HINTS.SpeakHint") RunTree("10_SBB_Zugabteil_Szenenwahl") } } } RunTree("10_SBB_Zugabteil_Szenenwahl_Selection") } } Tree("10_SBB_Zugabteil_Szenenwahl_Selection") { // --- Zugabteil - Szenenwahl Selection --- Composite(Sequence) { Composite(Selector) { Composite(Sequence) { // Story A besucht BTC.StoryAVisited() Composite(Selector) { Composite(Sequence) { // Story A + B besucht BTC.StoryBVisited() // --- Story Ende --- Composite(Marathon) { Composite(Sequence) { BTC.Show("GO.HINTS.SitDownHint") BTC.Wait(5) BTC.Hide("GO.HINTS.SitDownHint") } Composite(Sequence) { BTC.Hide("MediaPlayer.VIDEOS.IntroFidle1") BTC.Run("MediaPlayer.VIDEOS.StoryEndeF1") } } BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.00Menu") } Composite(Sequence) { // Story A besucht // Story B nicht besucht // --- Repetition Intro B --- BTC.Show("GO.HINTS.SitDownHint") BTC.Hide("MediaPlayer.VIDEOS.IntroFidle1") BTC.Run("MediaPlayer.VIDEOS.RepetitionIntroBF1") BTC.Run("MediaPlayer.VIDEOS.RepetitionIntroBFi_2") BTC.Hide("GO.HINTS.SitDownHint") RunTree("10_SBB_Zugabteil_Szenenwahl") } } } Composite(Sequence) { // Story A nicht besucht BTC.StoryBVisited() // Story B besucht // Story A nicht besucht // --- Repetition Intro A --- BTC.Show("GO.HINTS.SitDownHint") BTC.Hide("MediaPlayer.VIDEOS.IntroFidle1") BTC.Run("MediaPlayer.VIDEOS.RepetitionIntroAF1") BTC.Run("MediaPlayer.VIDEOS.RepetitionIntroAFi_2") BTC.Hide("GO.HINTS.SitDownHint") RunTree("10_SBB_Zugabteil_Szenenwahl") } Composite(Sequence) { // Story A + B nicht besucht RunTree("10_SBB_Zugabteil_Intro") } } // First Selector } // Sequence } Tree("10_SBB_Zugabteil_Szenenwahl") { // --- Zugabteil - Szenenwahl --- Composite(Sequence) { Composite(Marathon) { BTC.Hide("MediaPlayer.VIDEOS.RepetitionIntroAFi_2") BTC.Hide("MediaPlayer.VIDEOS.RepetitionIntroBFi_2") BTC.Hide("MediaPlayer.VIDEOS.IntroFidle1") } BTC.Run("MediaPlayer.VIDEOS.SzenenwahlF1") BTC.Run("MediaPlayer.VIDEOS.SzenenwahlFidle2") BTC.AddPossbileSpeechIntent("Zugabteil-Exposition-U-4a") BTC.AddPossbileSpeechIntent("Zugabteil-Exposition-U-4b") BTC.StartSpeechIntentRecognition() BTC.Show("GO.HINTS.SpeakHint") Composite(Race) { // -- Race 1: User sagt etwas Composite(Sequence) { BTC.UserStartedSpeechInput() BTC.Hide("GO.HINTS.SpeakHint") Composite(Selector) { // -- Selector 1: Intent erkannt Composite(Sequence) { BTC.SpeechIntentRecognized() // Intent erkannt Composite(Race) { Composite(Sequence) { BTC.CompareIntentID("Zugabteil-Exposition-U-4a") BTC.ClearPossbileSpeechIntents() // Load Scene: Story A Picknicken //BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.20SBB") } Composite(Sequence) { BTC.CompareIntentID("Zugabteil-Exposition-U-4b") BTC.ClearPossbileSpeechIntents() // Load Scene: Story B Grotto //BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.30SBB") } } } // -- 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.Hide("GO.HINTS.SpeakHint") } } BTC.Hide("MediaPlayer.VIDEOS.SzenenwahlFidle2") BTC.Run("MediaPlayer.VIDEOS.SzenenwahlF3") BTC.Run("MediaPlayer.VIDEOS.SzenenwahlFidle4") Composite(Race) { // VR Brille nehmen Composite(Sequence) { BTC.Run("NamedGrabEvent.INTERACTABLES.VRBrille") Composite(Marathon) { BTC.SetEntryLevel(0) BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button") BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Hide("GO.HANDMENU.SpeechOptions") } BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.40Puschlav") } // Szenenwahl per Handmenu Composite(Sequence) { Composite(Marathon) { BTC.Show("GO.HANDMENU.SpeechButton") BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "picnic") BTC.Show("GO.HANDMENU.Option1Button") BTC.Set("TextMeshPro.HANDMENU.Option2Button", "text", "grotto") BTC.Show("GO.HANDMENU.Option2Button") } Composite(Race) { Composite(Sequence) { // picnic BTC.Run("NamedEventTrigger.HANDMENU.Option1Button") Composite(Marathon) { BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Hide("GO.HANDMENU.SpeechOptions") } // Load Scene: Story A Picknicken //BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.20SBB") } Composite(Sequence) { // grotto BTC.Run("NamedEventTrigger.HANDMENU.Option2Button") Composite(Marathon) { BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option1Button") BTC.Hide("GO.HANDMENU.Option2Button") BTC.Hide("GO.HANDMENU.SpeechButton") BTC.Hide("GO.HANDMENU.SpeechOptions") } // Load Scene: Story B Grotto //BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black") BTC.Run("LoadScene.NEXT.30SBB") } } // Race Buttons } // Handmenu Ende } // TODO: Check if necessary //BTC.Hide("MediaPlayer.VIDEOS.SzenenwahlFidle4") } }