1
0
forked from cgvr/DeltaVR

cafe waiter npc always hides notebook when player leaves

This commit is contained in:
2026-02-08 10:46:00 +02:00
parent 9542432701
commit c9494f2d69

View File

@@ -55,7 +55,6 @@ public class CafeWaiterNPC : NPCController
fmodWhisperBridge.ActivateRecording(); fmodWhisperBridge.ActivateRecording();
notepad.SetActive(true); notepad.SetActive(true);
state = 1; 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 currently not bringing food and the player leaves, then go back to idle state
if (state != 3) if (state != 3)
{ {
notepad.SetActive(false);
notepad.transform.localRotation = Quaternion.Euler(notepadOriginalRotation);
state = 0; state = 0;
} }
} }
@@ -77,16 +78,13 @@ public class CafeWaiterNPC : NPCController
{ {
if (Time.time < lastPlayerVoiceUpdateTime + 0.5f) if (Time.time < lastPlayerVoiceUpdateTime + 0.5f)
{ {
Debug.Log("voiceline: player said '" + playerText + "' but not enough time passed");
return; return;
} }
if (string.IsNullOrEmpty(playerText) || playerText.Contains("BLANK_AUDIO")) if (IsPlayerSpeechMeaningless(playerText))
{ {
Debug.Log("player speech event but result empty");
return; return;
} }
lastPlayerVoiceUpdateTime = Time.time; lastPlayerVoiceUpdateTime = Time.time;
Debug.Log("state = " + state.ToString() + ", voiceline: player text: " + playerText);
if (state == 1) if (state == 1)
{ {
@@ -115,7 +113,7 @@ public class CafeWaiterNPC : NPCController
private void OnPlayerSpeechUpdate(string playerText) private void OnPlayerSpeechUpdate(string playerText)
{ {
if (string.IsNullOrEmpty(playerText) || playerText.Contains("BLANK_AUDIO")) if (IsPlayerSpeechMeaningless(playerText))
{ {
return; 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() private async void BringFood()
{ {
notepad.SetActive(false); notepad.SetActive(false);