forked from cgvr/DeltaVR
microphone stand has separate enter and exit proximity triggers
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MicrophoneProximityTrigger : MonoBehaviour
|
||||
{
|
||||
public MicrophoneStand mic;
|
||||
public bool isEnter;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (isEnter && other.gameObject.tag == "Player Head")
|
||||
{
|
||||
Debug.Log("collided with: " + other.gameObject.name);
|
||||
mic.OnPlayerApproach();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (!isEnter && other.gameObject.tag == "Player Head")
|
||||
{
|
||||
Debug.Log("collider left with: " + other.gameObject.name);
|
||||
mic.OnPlayerLeave();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user