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.
31 lines
708 B
31 lines
708 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 路段车辆流量检测器
|
|
/// </summary>
|
|
public class RoadChecker : MonoBehaviour
|
|
{
|
|
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Car")
|
|
{
|
|
GameRoot.Instance.roadSys.SetCheckerValue(this.gameObject.name,1);
|
|
// Debug.Log(this.gameObject.name+"+1");
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Car")
|
|
{
|
|
GameRoot.Instance.roadSys.SetCheckerValue(this.gameObject.name, -1);
|
|
// Debug.Log(this.gameObject.name + "-1");
|
|
}
|
|
}
|
|
|
|
}
|