forked from cgvr/DeltaVR
microphone stand has separate enter and exit proximity triggers
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user