Add button and entry point to KI-Chatbot

This commit is contained in:
Nadine Ganz 2026-05-21 17:51:00 +02:00
parent 8a808b5482
commit 4eef281201
6 changed files with 1118 additions and 760 deletions

View File

@ -11,8 +11,19 @@
BTC.SetBool("error")
}
Composite(Sequence) {
RunTree("26_Castello_Castelli_di_Bellinzona_Intro")
Composite(Selector) {
Composite(Sequence) {
// Check KI Chat
BTC.CheckEntryLevel(2)
BTC.SetBool("InitOffeneFragen")
BTC.Run("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
BTC.ResetEntryLevel(2)
RunTree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_offene_Fragen")
}
Composite(Sequence) {
RunTree("26_Castello_Castelli_di_Bellinzona_Intro")
}
}
}
@ -281,65 +292,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Intro") {
}
}
// --- Castelli di Bellinzona - Outro ---
Composite(Marathon) {
BTC.Hide("GO.HINTS.SpeechErrorHint")
BTC.Hide("MediaPlayer.VIDEOS.ChatbotBurgenFidle_12")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle04")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotInterak_FIdle02")
}
BTC.Run("MediaPlayer.VIDEOS.OutroF1")
BTC.Run("MediaPlayer.VIDEOS.OutroFidle2")
BTC.AddPossbileSpeechIntent("Castelli_di_Bellinzona-Outro-U-2a")
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.OutroFidle2")
Composite(Marathon) {
BTC.Run("MediaPlayer.VIDEOS.OutroF3")
Composite(Sequence) {
BTC.Wait(2.5)
BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black")
}
}
BTC.SetStoryAVisited()
BTC.Run("LoadScene.NEXT.10SBB")
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
}
}
@ -636,6 +589,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Chatbot_Burgen_Entscheidung_Offene_Frag
BTC.CompareIntentID("Castelli_di_Bellinzona-Chatbot_Burgen-U-12b")
BTC.ClearPossbileSpeechIntents()
// Go to Outro
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
}
}
}
@ -671,6 +625,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Chatbot_Burgen_Entscheidung_Offene_Frag
BTC.Hide("GO.GO.Option2Button")
BTC.Hide("GO.GO.SpeechOptions")
// Go To Outro
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
}
}
}
@ -708,6 +663,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_offene_Fragen") {
BTC.Show("GO.Canvaspanoramatafelslideshow.SlideshowChatbot")
}
BTC.Show("GO.HINTS.StandUpHint")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
}
Composite(Marathon) {
@ -748,6 +704,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_offene_Fragen") {
BTC.Wait(10)
BTC.CompareBool("UserStartetBot", false)
BTC.AbortEventListener("NamedPokeEvent.INTERACTABLES.ChatbotButton")
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
}
}
}
@ -770,5 +727,71 @@ Tree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_Interaktion") {
BTC.ChatbotConversationEnded()
BTC.SpeechOutputEnded()
BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_End")
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
}
}
Tree("26_Castello_Castelli_di_Bellinzona_Outro") {
// --- Castelli di Bellinzona - Outro ---
Composite(Sequence) {
Composite(Marathon) {
BTC.Hide("GO.HINTS.SpeechErrorHint")
BTC.Hide("MediaPlayer.VIDEOS.ChatbotBurgenFidle_12")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle04")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotInterak_FIdle02")
}
BTC.Run("MediaPlayer.VIDEOS.OutroF1")
BTC.Run("MediaPlayer.VIDEOS.OutroFidle2")
BTC.AddPossbileSpeechIntent("Castelli_di_Bellinzona-Outro-U-2a")
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.OutroFidle2")
Composite(Marathon) {
BTC.Run("MediaPlayer.VIDEOS.OutroF3")
Composite(Sequence) {
BTC.Wait(2.5)
BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black")
}
}
BTC.SetStoryAVisited()
BTC.Run("LoadScene.NEXT.10SBB")
}
}

View File

@ -1035,7 +1035,7 @@ public class BTC : MonoBehaviour {
string languageCode = "it-IT";
string instructions = "Rispondi sempre in italiano. Rispondi in lingua colloquiale al livelli di competenza A2 di quadro comune europeo di riferimento per la conoscenza delle lingue.";
string context = "Sei un essere onnisciente che risponde esclusivamente a domande sulla cultura e la storia del Cantone Ticino e dei Castelli di Bellinzona. Parla <Ciao, cosa vuoi sapere? Sono unintelligenza artificiale>. Rispondi sempre nel modo più conciso possibile. Suddividi le domande in passaggi più piccoli e sviluppale. Chiedi se hanno capito tutto. La conversazione ha inizio.";
int maxRoundTrips = 5;
int maxRoundTrips = 10;
float maxSilenceBeforeTimeOut = 10;
string outroText = $"Grazie mille, la conversazione è finita.";

View File

@ -1 +1 @@
2026-05-05T14:05:39.5205530Z
2026-05-21T15:25:17.3240080Z

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ public static class EntryLevel
/* Entry Levels:
* 0: Minigame SBB
* 1: Minigame Grotto
* 1: KI-Chat Castello
*/
public static bool[] entries = new bool[2];
public static bool[] entries = new bool[3];
}

View File

@ -48,6 +48,12 @@ public class LevelManager : MonoBehaviour
// This method is called when a button is clicked, and loads the given scene by name
public void OnClickLoadLevel(string sceneName)
{
if (sceneName == "2.6-Castello-KI")
{
EntryLevel.entries[2] = true;
sceneName = "2.6-Castello";
}
StartCoroutine(LoadAsyncScene(sceneName));
}