TIF_E4120018/Assets/Script/NotMatchCollider.cs

27 lines
704 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NotMatchCollider : MonoBehaviour
{
public GameObject panelWarning;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("man-mask") || other.gameObject.CompareTag("mug-viruses"))
{
Debug.Log("object man and mask touched");
panelWarning.SetActive(true);
}
}
void OnTriggerExit(Collider other)
{
if (other.gameObject.CompareTag("man-mask") || other.gameObject.CompareTag("mug-viruses"))
{
Debug.Log("object man and mask untouched");
panelWarning.SetActive(false);
}
}
}