void OnTriggerExit(Collider col) { if (col.tag != "ParkingSpace") { return; } if (carParkController == null) { carParkController = GameObject.FindObjectOfType <CarParkController>(); } ParkingSpace ps = carParkController.GetParkingSpace(col.gameObject); if (ps.occupied == true) { return; } carParkController.ToggleParkingSpaceIndicator(ps, false); }
void OnTriggerStay(Collider col) { if (col.tag != "ParkingSpace") { return; } if (carParkController == null) { carParkController = GameObject.FindObjectOfType <CarParkController>(); } ParkingSpace ps = carParkController.GetParkingSpace(col.gameObject); if (ps.occupied == true) { return; } carParkController.ToggleParkingSpaceIndicator(ps, true); WorldController.Instance.world.ParkCar(ps); }