/// <summary> /// Disable the Car /// </summary> protected override void DisableCar() { //Call Base Function base.DisableCar(); if (carAIChase) { carAIChase.enabled = false; } //Set the inputs of the car to 0 so it stops if (controllingCar) { controllingCar.CarSteerInput = 0f; controllingCar.CarAccelerateInput = 0f; } //Remove as an active car CarDisabled?.Invoke(this); //Set an coroutine to destroy this object when it is out of view Destroy(gameObject, despawnTime); }
private void OnDestroy() { CarDisabled?.Invoke(this); }