forked from cgvr/DeltaVR
28 lines
689 B
C#
28 lines
689 B
C#
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();
|
|
}
|
|
}
|
|
}
|