Example #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Car")
     {
         CarAI car = other.gameObject.GetComponent <CarAI> ();
         if (car.isGoingToSensor() || sensors.Count == 0)
         {
             car.setInitialDestination();
         }
         else
         {
             car.setDestination(getClosestSensorPosition(car.getInitialDestination()));
         }
     }
 }