private void Awake() { if (!vehicleController) { vehicleController = GetComponent <IKD_VehicleController>(); } }
void StartSound() { fadeOut = false; // get the carcontroller ( this will not be null as we have require component) carController = GetComponent <IKD_VehicleController>(); // setup the simple audio source lhighAccel = SetUpEngineAudioSource(highAccelClip); // if we have four channel audio setup the four audio sources if (engineSoundStyle == EngineAudioOptions.FourChannel) { lowAccel = SetUpEngineAudioSource(lowAccelClip); lowDecel = SetUpEngineAudioSource(lowDecelClip); lhighDecel = SetUpEngineAudioSource(highDecelClip); } fadeInVolume = 0f; // flag that we have started the sounds playing startedSound = true; fadeIn = true; }