From c9494f2d69e9985773e6e0a29581071000bc2e86 Mon Sep 17 00:00:00 2001 From: henrisel Date: Sun, 8 Feb 2026 10:46:00 +0200 Subject: [PATCH] cafe waiter npc always hides notebook when player leaves --- .../Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs index aef4335d..f22d2469 100644 --- a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs +++ b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs @@ -55,7 +55,6 @@ public class CafeWaiterNPC : NPCController fmodWhisperBridge.ActivateRecording(); notepad.SetActive(true); - state = 1; } } @@ -69,6 +68,8 @@ public class CafeWaiterNPC : NPCController // If currently not bringing food and the player leaves, then go back to idle state if (state != 3) { + notepad.SetActive(false); + notepad.transform.localRotation = Quaternion.Euler(notepadOriginalRotation); state = 0; } } @@ -77,16 +78,13 @@ public class CafeWaiterNPC : NPCController { if (Time.time < lastPlayerVoiceUpdateTime + 0.5f) { - Debug.Log("voiceline: player said '" + playerText + "' but not enough time passed"); return; } - if (string.IsNullOrEmpty(playerText) || playerText.Contains("BLANK_AUDIO")) + if (IsPlayerSpeechMeaningless(playerText)) { - Debug.Log("player speech event but result empty"); return; } lastPlayerVoiceUpdateTime = Time.time; - Debug.Log("state = " + state.ToString() + ", voiceline: player text: " + playerText); if (state == 1) { @@ -115,7 +113,7 @@ public class CafeWaiterNPC : NPCController private void OnPlayerSpeechUpdate(string playerText) { - if (string.IsNullOrEmpty(playerText) || playerText.Contains("BLANK_AUDIO")) + if (IsPlayerSpeechMeaningless(playerText)) { return; } @@ -126,6 +124,11 @@ public class CafeWaiterNPC : NPCController } } + private bool IsPlayerSpeechMeaningless(string playerText) + { + return string.IsNullOrEmpty(playerText) || playerText.Contains("BLANK_AUDIO") || playerText.Trim().Equals("[ Silence ]"); + } + private async void BringFood() { notepad.SetActive(false);