private void checkCarCollision(float time) { if (otherCars != null) { foreach (GameObject otherCar in otherCars) { if (ProximityTester.proximityMagnitudeTest(carCollisionProximityRange, this.transform.position, otherCar.transform.position)) { return; } } } moveCheck(time); }
// Update is called once per frame void Update() { float time = Time.deltaTime; if (!willChange && playerCar != null) { if (ProximityTester.proximityMagnitudeTest(proximityRange, this.transform.position, playerCar.transform.position)) { willChange = true; } } if (willChange && totalTime < moveTime) { Move(time); totalTime += time; } }