forked from cgvr/DeltaVR
improve text recognition reliability, unsubscribe from Whisper events when not wanted anymore
This commit is contained in:
@@ -24,8 +24,6 @@ public class CafeWaiterNPC : NPCController
|
||||
|
||||
private void Start()
|
||||
{
|
||||
fmodWhisperBridge.OnWhisperResultProcessed += ProcessPlayerSpeech;
|
||||
|
||||
notepadOriginalRotation = notepadTransform.localRotation.eulerAngles;
|
||||
notepadFlippedRotation = notepadOriginalRotation + new Vector3(0, 180, 0);
|
||||
}
|
||||
@@ -33,12 +31,17 @@ public class CafeWaiterNPC : NPCController
|
||||
protected override void OnPlayerApproach()
|
||||
{
|
||||
AudioManager.Instance.PlayDialogue(voiceLineKeys[0], gameObject);
|
||||
|
||||
fmodWhisperBridge.OnWhisperSegmentUpdated += OnPlayerSpeechUpdate;
|
||||
fmodWhisperBridge.OnWhisperSegmentFinished += ProcessPlayerSpeech;
|
||||
fmodWhisperBridge.ActivateRecording();
|
||||
}
|
||||
|
||||
protected override void OnPlayerLeave()
|
||||
{
|
||||
//AudioManager.Instance.PlayDialogue(voiceLineKeys[1], gameObject);
|
||||
fmodWhisperBridge.OnWhisperSegmentUpdated -= OnPlayerSpeechUpdate;
|
||||
fmodWhisperBridge.OnWhisperSegmentFinished -= ProcessPlayerSpeech;
|
||||
fmodWhisperBridge.DeactivateRecording();
|
||||
}
|
||||
|
||||
@@ -67,4 +70,13 @@ public class CafeWaiterNPC : NPCController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayerSpeechUpdate(string playerText)
|
||||
{
|
||||
if (string.IsNullOrEmpty(playerText) || playerText.Equals("BLANK_AUDIO"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
notepadText.text = playerText;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user