You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
806 B
42 lines
806 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DistanceChecker : MonoBehaviour
|
|
{
|
|
//是否无障碍
|
|
public bool noObstacle = true;
|
|
|
|
|
|
|
|
public bool IsNoObstacle()
|
|
{
|
|
return noObstacle;
|
|
}
|
|
|
|
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Car")
|
|
{
|
|
//Drive drive = other.GetComponent<Drive>();
|
|
//if (drive!= null&&drive.dirveState==DriveState.Turn)
|
|
//{
|
|
// noObstacle = true;
|
|
// return;
|
|
//}
|
|
noObstacle = false;
|
|
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Car")
|
|
{
|
|
noObstacle = true;
|
|
}
|
|
}
|
|
}
|