private float m_WindSpeedPitchFactor = 0.004f; // Relative increase in pitch of the wind from the plane's speed. #endregion Fields #region Methods private void Awake() { // Set up the reference to the aeroplane controller. m_Plane = GetComponent<AeroplaneControllerUScript> (); m_Rigidbody = GetComponent<Rigidbody> (); // Add the audiosources and get the references. m_EngineSoundSource = gameObject.AddComponent<AudioSource> (); m_EngineSoundSource.playOnAwake = false; m_WindSoundSource = gameObject.AddComponent<AudioSource> (); m_WindSoundSource.playOnAwake = false; // Assign clips to the audiosources. m_EngineSoundSource.clip = m_EngineSound; m_WindSoundSource.clip = m_WindSound; // Set the parameters of the audiosources. m_EngineSoundSource.minDistance = m_AdvancedSetttings.engineMinDistance; m_EngineSoundSource.maxDistance = m_AdvancedSetttings.engineMaxDistance; m_EngineSoundSource.loop = true; m_EngineSoundSource.dopplerLevel = m_AdvancedSetttings.engineDopplerLevel; m_WindSoundSource.minDistance = m_AdvancedSetttings.windMinDistance; m_WindSoundSource.maxDistance = m_AdvancedSetttings.windMaxDistance; m_WindSoundSource.loop = true; m_WindSoundSource.dopplerLevel = m_AdvancedSetttings.windDopplerLevel; // call update here to set the sounds pitch and volumes before they actually play Update (); // Start the sounds playing. m_EngineSoundSource.Play (); m_WindSoundSource.Play (); }
private void Awake() { // Set up the reference to the aeroplane controller. m_Plane = GetComponent <AeroplaneControllerUScript> (); m_Rigidbody = GetComponent <Rigidbody> (); // Add the audiosources and get the references. m_EngineSoundSource = gameObject.AddComponent <AudioSource> (); m_EngineSoundSource.playOnAwake = false; m_WindSoundSource = gameObject.AddComponent <AudioSource> (); m_WindSoundSource.playOnAwake = false; // Assign clips to the audiosources. m_EngineSoundSource.clip = m_EngineSound; m_WindSoundSource.clip = m_WindSound; // Set the parameters of the audiosources. m_EngineSoundSource.minDistance = m_AdvancedSetttings.engineMinDistance; m_EngineSoundSource.maxDistance = m_AdvancedSetttings.engineMaxDistance; m_EngineSoundSource.loop = true; m_EngineSoundSource.dopplerLevel = m_AdvancedSetttings.engineDopplerLevel; m_WindSoundSource.minDistance = m_AdvancedSetttings.windMinDistance; m_WindSoundSource.maxDistance = m_AdvancedSetttings.windMaxDistance; m_WindSoundSource.loop = true; m_WindSoundSource.dopplerLevel = m_AdvancedSetttings.windDopplerLevel; // call update here to set the sounds pitch and volumes before they actually play Update(); // Start the sounds playing. m_EngineSoundSource.Play(); m_WindSoundSource.Play(); }
private float m_ThrottleBlurStart = 0.25f; // The point at which the blurred textures start. #endregion Fields #region Methods private void Awake() { // Set up the reference to the aeroplane controller. m_Plane = GetComponent<AeroplaneControllerUScript> (); m_PropellorModelRenderer = m_PropellorModel.GetComponent<Renderer> (); m_PropellorBlurRenderer = m_PropellorBlur.GetComponent<Renderer> (); // Set the propellor blur gameobject's parent to be the propellor. m_PropellorBlur.parent = m_PropellorModel; }
private void Awake() { // Set up the reference to the aeroplane controller. m_Plane = GetComponent <AeroplaneControllerUScript> (); m_PropellorModelRenderer = m_PropellorModel.GetComponent <Renderer> (); m_PropellorBlurRenderer = m_PropellorBlur.GetComponent <Renderer> (); // Set the propellor blur gameobject's parent to be the propellor. m_PropellorBlur.parent = m_PropellorModel; }