private void Awake()
        {
            // Set up the reference to the aeroplane controller.
            m_Plane     = GetComponent <AeroplaneControllerSM>();
            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();
        }
Exemplo n.º 2
0
        private AeroplaneControllerSM m_Plane;                       // Reference to the aeroplane controller.


        private void Start()
        {
            // Get the reference to the aeroplane controller.
            m_Plane = GetComponent <AeroplaneControllerSM>();

            // Store the original local rotation of each surface, so we can rotate relative to this
            foreach (var surface in m_ControlSurfaces)
            {
                surface.originalLocalRotation = surface.transform.localRotation;
            }
        }
        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.startLifetime;
//            m_OriginalStartSize = m_System.startSize;
//            m_OriginalStartColor = m_System.startColor;

            //v3.4.9
            ParticleSystem.MainModule MainMod = m_System.main;             //v3.4.9
            m_OriginalLifetime   = MainMod.startLifetime.constant;
            m_OriginalStartSize  = MainMod.startSize.constant;
            m_OriginalStartColor = MainMod.startColor.color;
        }
 private void Awake()
 {
     // Set up the reference to the aeroplane controller.
     m_Aeroplane = GetComponent <AeroplaneControllerSM>();
 }