Example #1
0
        private void StartSound()
        {
            // get the carcontroller ( this will not be null as we have require component)
            m_CarController = GetComponent <CarControlSystem>();

            // setup the simple audio source
            m_HighAccel = SetUpEngineAudioSource(m_HighAccelClip);

            // if we have four channel audio setup the four audio sources
            if (m_EngineSoundStyle == EngineAudioOptions.FourChannel)
            {
                m_LowAccel  = SetUpEngineAudioSource(m_LowAccelClip);
                m_LowDecel  = SetUpEngineAudioSource(m_LowDecelClip);
                m_HighDecel = SetUpEngineAudioSource(m_HighDecelClip);
            }

            // flag that we have started the sounds playing
            m_StartedSound = true;
        }
        protected CarControlSystem controlSystem;         // the car controller we want to use

        #endregion

        #region Actions

        protected virtual void Awake()
        {
            controlSystem = GetComponent <CarControlSystem>();
        }