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();
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);