private void Awake() { // Set up the reference to the aeroplane controller. m_Plane = GetComponent <PlaneControleur>(); 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 <PlaneControleur>(); // m_PropellorModelRenderer = m_PropellorModel.GetComponent<Renderer>(); // m_PropellorBlurRenderer = m_PropellorBlur.GetComponent<Renderer>(); }
private Color m_OriginalStartColor; // The original starting colout of the particle system // Use this for initialization private void Start() { // get the aeroplane from the object hierarchy m_Jet = FindAeroplaneParent(); // get the particle system ( it will be on the object as we have a require component set up m_System = GetComponent <ParticleSystem>(); // set the original properties from the particle system m_OriginalLifetime = m_System.main.startLifetime.constant; m_OriginalStartSize = m_System.main.startSize.constant; m_OriginalStartColor = m_System.main.startColor.color; }