Intro scene SBB: handling speech input

dev
Nadine Ganz 2024-10-04 17:08:47 +02:00
parent 1524064f0b
commit 0e84fcdd7c
6 changed files with 349002 additions and 517625 deletions

View File

@ -9,6 +9,7 @@ Tree("10_SBB_Zugabteil_Szenenwahl_Selection") {
Composite(Sequence) {
BTC.GetKeyDown("Return")
BTC.SetBool("handmenu_active", false)
Composite(Selector) {
Composite(Sequence) {
@ -25,17 +26,19 @@ Tree("10_SBB_Zugabteil_Szenenwahl_Selection") {
// Story A + B + C besucht
BTC.StoryCVisited()
// --- Zugabteil - Story Ende ---
// ...
BTC.SynthesizeText("Hey, jetzt waren wir drei Tage unterwegs, wir haben das Grotto meiner Nonna besucht, waren beim Castello die Montebello picknicken und im Puschlav wandern. Ich hoffe, ich konnte dir meine Heimat etwas näherbringen. Mit den Fotos, die du gemacht hast, haben wir auch tolle Erinnerungen. Besuche mich doch wieder einmal, das würde mich freuen! Gute Heimreise!", "de-DE", "")
BTC.SpeechOutputEnded()
BTC.GetKeyDown("Return")
// --- ENDE ---
}
Composite(Sequence) {
// Story A + B besucht
// Story C nicht besucht
// --- Zugabteil - Repetition Intro C ---
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryCVisited()
BTC.SynthesizeText("Nun haben wir schon zwei tolle Ausflüge gemacht. Wie wärs heute mit einer Wanderung im Puschlav?", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
}
}
@ -48,17 +51,18 @@ Tree("10_SBB_Zugabteil_Szenenwahl_Selection") {
// Story A + C besucht
// Story B nicht besucht
// --- Zugabteil - Repetition Intro B ---
// ...
BTC.GetKeyDown("Return")
BTC.SynthesizeText("Nun haben wir schon zwei tolle Ausflüge gemacht. Wie wärs heute mit einem feinen Risotto im Grotto meiner Nonna im Misox?", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
Composite(Sequence) {
// Story A besucht
// Story B + C nicht besucht
// --- Zugabteil - Repetition Intro BC ---
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryBVisited()
BTC.SynthesizeText("Heute ist ein neuer Tag für einen Ausflug. Was möchtest du unternehmen? Wie wärs mit einem feinen Risotto im Grotto meiner Nonna im Misox? Oder einer Wanderung im Puschlav?", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
}
}
@ -76,16 +80,18 @@ Tree("10_SBB_Zugabteil_Szenenwahl_Selection") {
// Story B + C besucht
// Story A nicht besucht
// --- Zugabteil - Repetition Intro A ---
// ...
BTC.GetKeyDown("Return")
BTC.SynthesizeText("Nun haben wir schon zwei tolle Ausflüge gemacht. Wie wärs heute mit einem chilligen Picknick oben bei den Castelli?", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
Composite(Sequence) {
// Story B besucht
// Story A + C nicht besucht
// --- Zugabteil - Repetition Intro AC ---
// ...
BTC.GetKeyDown("Return")
BTC.SynthesizeText("Heute ist ein neuer Tag für einen Ausflug. Was möchtest du unternehmen? Wie wärs mit einem chilligen Picknick oben bei den Castelli? Oder einer Wanderung im Puschlav?", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
}
}
@ -97,39 +103,321 @@ Tree("10_SBB_Zugabteil_Szenenwahl_Selection") {
// Story C besucht
// Story A + B nicht besucht
// --- Zugabteil - Repetition Intro AB ---
// ...
BTC.GetKeyDown("Return")
BTC.SynthesizeText("Heute ist ein neuer Tag für einen Ausflug. Was möchtest du unternehmen? Wie wärs mit einem chilligen Picknick oben beim Castello di Montebello? Oder hast du Lust auf einen feinen Risotto im Grotto meiner Nonna im Misox?", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
Composite(Sequence) {
// Nichts besucht
BTC.GetKeyDown("Return")
Composite(Selector) {
Composite(Sequence) {
BTC.CompareRepetitionVisitedCounter(0)
// --- Zugabteil - Intro ABC erste ---
// ...
BTC.IncrementRepetitionVisitedCounter()
BTC.GetKeyDown("Return")
BTC.SynthesizeText("Worauf hast du denn heute Lust? A) Picknick in Bellinzona, B) Grotto im Misox oder C) Wanderung im Puschlav?", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
Composite(Sequence) {
// Erste Wiederholung
BTC.CompareRepetitionVisitedCounter(1)
// --- Zugabteil - Intro ABC zweite ---
// ...
BTC.IncrementRepetitionVisitedCounter()
BTC.GetKeyDown("Return")
BTC.SynthesizeText("Wir kommen bald an. Welchen Ausflug möchtest du machen? A) Picknicken, B) im Grotto was Feines essen oder C) Wandern", "de-DE", "")
BTC.SpeechOutputEnded()
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
Composite(Sequence) {
// Zweite Wiederholung
BTC.CompareRepetitionVisitedCounter(2)
// --- Zugabteil - Intro ABC dritte ---
// ...
BTC.GetKeyDown("Return")
BTC.SynthesizeText("Jetzt musst du dich entscheiden: A) Picknicken, B) im Grotto was Feines essen oder C) Wandern. Du kannst auch die Hilfe auf dem Handy in deiner linken Hand verwenden.", "de-DE", "")
BTC.SpeechOutputEnded()
BTC.SetBool("handmenu_active")
RunTree("10_SBB_Zugabteil_Szenenwahl")
}
}
}
} // First Selector
} // Sequence
}
Tree("10_SBB_Zugabteil_Szenenwahl") {
Composite(Sequence) {
BTC.AddPossbileSpeechIntent("Zugabteil.Szenenwahl.3", "A (oder Picknick)")
BTC.AddPossbileSpeechIntent("Zugabteil.Szenenwahl.5", "B (oder Grotto)")
BTC.AddPossbileSpeechIntent("Zugabteil.Szenenwahl.7", "C (oder Wandern)")
BTC.StartSpeechIntentRecognition()
Composite(Race) {
// -- Race 1: User sagt etwas
Composite(Sequence) {
BTC.UserStartedSpeechInput()
Composite(Selector) {
// -- Selector 1: Intent erkannt
Composite(Sequence) {
BTC.SpeechIntentRecognized()
BTC.AbortEventListener("NamedGrabEvent.INTERACTABLES.VRBrille")
// Intent erkannt
Composite(Race) {
Composite(Sequence) {
BTC.CompareIntentID("Zugabteil.Szenenwahl.3")
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story A Picknicken
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryAVisited()
}
Composite(Sequence) {
BTC.CompareIntentID("Zugabteil.Szenenwahl.5")
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story B Grotto
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryBVisited()
}
Composite(Sequence) {
BTC.CompareIntentID("Zugabteil.Szenenwahl.7")
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story C Wandern
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryCVisited()
}
}
}
// -- Selector 2: Intent nicht erkannt
Composite(Sequence) {
BTC.AbortEventListener("NamedGrabEvent.INTERACTABLES.VRBrille")
// Fallback: nicht verstanden, wiederholen
// ...
BTC.SynthesizeText("Ich habe dich leider nicht verstanden. Kannst du das bitte wiederholen? Alternativ kannst du auch die Hilfe auf dem Handy in deiner linken Hand verwenden.", "de-DE", "")
BTC.SpeechOutputEnded()
BTC.StartSpeechIntentRecognition()
Composite(Race) {
Composite(Sequence) {
// Option 1: Spracheingabe
BTC.UserStartedSpeechInput()
BTC.SpeechIntentRecognized()
Composite(Race) {
Composite(Sequence) {
BTC.CompareIntentID("Zugabteil.Szenenwahl.3")
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story A Picknicken
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryAVisited()
}
Composite(Sequence) {
BTC.CompareIntentID("Zugabteil.Szenenwahl.5")
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story B Grotto
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryBVisited()
}
Composite(Sequence) {
BTC.CompareIntentID("Zugabteil.Szenenwahl.7")
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story C Wandern
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryCVisited()
}
}
}
Composite(Sequence) {
// Option 2: Handmenu
Composite(Marathon) {
BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "picnic")
BTC.Show("GO.HANDMENU.Option1Button")
BTC.Set("TextMeshPro.HANDMENU.Option2Button", "text", "grotto")
BTC.Show("GO.HANDMENU.Option2Button")
BTC.Set("TextMeshPro.HANDMENU.Option3Button", "text", "escursione")
BTC.Show("GO.HANDMENU.Option3Button")
}
Composite(Race) {
Composite(Sequence) {
// picnic
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
Composite(Marathon) {
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option3Button")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story A Picknicken
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryAVisited()
}
Composite(Sequence) {
// grotto
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
Composite(Marathon) {
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option3Button")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story B Grotto
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryBVisited()
}
Composite(Sequence) {
// escursione
BTC.Run("NamedEventTrigger.HANDMENU.Option3Button")
Composite(Marathon) {
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option3Button")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story C Wandern
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryCVisited()
}
} // Ende Race Buttons
} // Ende Option 2 Handmenu
} // Ende Race Optionen
} // Ende Sequence
} // Ende Selector
} // Ende Sequence 1
// -- Race 2: User sagt nichts
Composite(Sequence) {
BTC.Wait(20)
BTC.CompareUserSpeechInputStarted(false)
Decorator(Inverter) {
BTC.CompareBool("handmenu_active")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
BTC.AbortEventListener("NamedGrabEvent.INTERACTABLES.VRBrille")
BTC.IncrementRepetitionVisitedCounter()
BTC.GetKeyDown("Return")
}
// -- Race 3: VR Brille in die Hand nehmen
Composite(Sequence) {
BTC.Run("NamedGrabEvent.INTERACTABLES.VRBrille")
Decorator(Inverter) {
BTC.CompareBool("handmenu_active")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
BTC.IncrementRepetitionVisitedCounter()
BTC.GetKeyDown("Return")
// --- Bilder Bergell ---
//BTC.Run("LoadScene.NEXT.35Slideshow")
}
// -- Race 4: Hand Menu
Composite(Sequence) {
BTC.CompareBool("handmenu_active")
Composite(Marathon) {
BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "picnic")
BTC.Show("GO.HANDMENU.Option1Button")
BTC.Set("TextMeshPro.HANDMENU.Option2Button", "text", "grotto")
BTC.Show("GO.HANDMENU.Option2Button")
BTC.Set("TextMeshPro.HANDMENU.Option3Button", "text", "escursione")
BTC.Show("GO.HANDMENU.Option3Button")
}
Composite(Race) {
Composite(Sequence) {
// picnic
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
Composite(Marathon) {
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button")
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option3Button")
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option3Button")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story A Picknicken
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryAVisited()
}
Composite(Sequence) {
// grotto
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
Composite(Marathon) {
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button")
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option3Button")
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option3Button")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story B Grotto
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryBVisited()
}
Composite(Sequence) {
// escursione
BTC.Run("NamedEventTrigger.HANDMENU.Option3Button")
Composite(Marathon) {
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button")
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Hide("GO.HANDMENU.Option2Button")
BTC.Hide("GO.HANDMENU.Option3Button")
}
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Load Scene: Story C Wandern
// ...
BTC.GetKeyDown("Return")
BTC.SetStoryCVisited()
}
}
}
} // Ende Race
}
}

View File

@ -45,6 +45,7 @@ public class NamedGrabEvent : ComponentHandler {
public string objName = "GrabObjXY";
private bool selectEnterTriggered = false;
private bool selectExitTriggered = false;
private bool _abortEventListener = false;
private void SelectEnterEventHandler(SelectEnterEventArgs args)
{
@ -85,6 +86,14 @@ public class NamedGrabEvent : ComponentHandler {
Task.SetSucceeded();
return;
}
if (_abortEventListener)
{
Task.SetFailed();
Debug.Log($"NamedGrabEvent on {gameObject.name} failed.");
_abortEventListener = false;
return;
}
}
public override void ListenToEvent(MyBT.NodeState nodeState)
@ -110,7 +119,15 @@ public class NamedGrabEvent : ComponentHandler {
return;
}
}
}
public override void AbortEventListener(MyBT.NodeState nodeState)
{
if (nodeState == NodeState.FirstRun)
{
_abortEventListener = true;
Task.SetSucceeded();
return;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -140,9 +140,6 @@ PlayerSettings:
bundleVersion: 0.1
preloadedAssets:
- {fileID: 11400000, guid: be340e3c48769439d8d18a5a2bccd498, type: 2}
- {fileID: 11400000, guid: bfa1182bd221b4ca89619141f66f1260, type: 2}
- {fileID: -8196854396901781169, guid: 1a4c68ca72a83449f938d669337cb305, type: 2}
- {fileID: -64324148185763206, guid: a9a6963505ddf7f4d886008c6dc86122, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1