1
0
forked from cgvr/DeltaVR

microphone stand has separate enter and exit proximity triggers

This commit is contained in:
2026-02-28 15:18:57 +02:00
parent 9d780f4dbc
commit d6a63a5de6
10 changed files with 269 additions and 453 deletions

View File

@@ -26,36 +26,26 @@ public class MicrophoneStand : MonoBehaviour
}
void OnTriggerEnter(Collider other)
public void OnPlayerApproach()
{
KbmController controller = other.GetComponent<KbmController>();
Debug.Log("Mic stand collided with object " + other.gameObject.name);
fmodWhisperBridge.OnWhisperSegmentUpdated += OnPlayerSpeechUpdated;
fmodWhisperBridge.OnWhisperSegmentFinished += OnPlayerSpeechFinished;
if (controller != null || other.gameObject.tag == "Player Head")
{
fmodWhisperBridge.OnWhisperSegmentUpdated += OnPlayerSpeechUpdated;
fmodWhisperBridge.OnWhisperSegmentFinished += OnPlayerSpeechFinished;
microphoneOffStatus.SetActive(false);
microphoneOnStatus.SetActive(true);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
fmodWhisperBridge.ActivateRecording();
}
microphoneOffStatus.SetActive(false);
microphoneOnStatus.SetActive(true);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
fmodWhisperBridge.ActivateRecording();
}
private void OnTriggerExit(Collider other)
public void OnPlayerLeave()
{
KbmController controller = other.GetComponent<KbmController>();
if (controller != null | other.gameObject.tag == "Player Head")
{
fmodWhisperBridge.OnWhisperSegmentUpdated -= OnPlayerSpeechUpdated;
fmodWhisperBridge.OnWhisperSegmentFinished -= OnPlayerSpeechFinished;
fmodWhisperBridge.OnWhisperSegmentUpdated -= OnPlayerSpeechUpdated;
fmodWhisperBridge.OnWhisperSegmentFinished -= OnPlayerSpeechFinished;
microphoneOffStatus.SetActive(true);
microphoneOnStatus.SetActive(false);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
fmodWhisperBridge.DeactivateRecording();
}
microphoneOffStatus.SetActive(true);
microphoneOnStatus.SetActive(false);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
fmodWhisperBridge.DeactivateRecording();
}
private void OnPlayerSpeechUpdated(string text)