H_SafeExperienceDrivingSystem/U3D_DrivingSystem/Assets/Script/Objective/trigger/Trigger_CrossWaring.cs

31 lines
831 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XFrame.Core.UI;
using XFrame.Core.UIs;
public class Trigger_CrossWaring : MonoBehaviour
{
public GameObject Persons;
private void OnTriggerEnter(Collider other)
{
if (other.transform.name.Contains("ColliderFront"))
{
Persons.SetActive(true);
XUIPanel.ShowPanel<CrossWarningPanel>();
XUIPanels.ShowPanel<CrossWarningPanels>();
}
}
private void OnTriggerExit(Collider other)
{
if (other.transform.name.Contains("ColliderFront"))
{
Persons.SetActive(false);
XUIPanel.ClosePanel<CrossWarningPanel>();
XUIPanels.ClosePanel<CrossWarningPanels>();
this.gameObject.SetActive(false);
}
}
}