public void OnTriggerExit(Collider other) { if (other.GetComponent <CarAnimation>() == NearestCar) { NearestCar = null; } }
public void OnTriggerEnter(Collider other) { if (NearestCar == null && other.GetComponent <CarAnimation>() != null) { NearestCar = other.GetComponent <CarAnimation>(); } }