示例#1
0
        public void Setup(AudioSettings settings = null)
        {
            if (settings == null)
            {
                settings = AudioSettingsTemplates.GetDefaultSettings();
            }

            m_Settings = settings;

            m_AudioSource.clip = settings.clip;
            m_AudioSource.outputAudioMixerGroup = settings.outputAudioMixerGroup;
            m_AudioSource.playOnAwake           = settings.playOnAwake;
            m_AudioSource.loop         = settings.loop;
            m_AudioSource.volume       = settings.volume;
            m_AudioSource.pitch        = settings.pitch;
            m_AudioSource.panStereo    = settings.panStereo;
            m_AudioSource.spatialBlend = settings.spatialBlend;

            m_hasInit = true;

            if (settings.playOnAwake)
            {
                Play();
            }
        }
示例#2
0
        public override void Init(AudioSettings p_audioSettings = null)
        {
            AudioSettings audioSettings = p_audioSettings == null?AudioSettingsTemplates.GetOneShotSettings(p_audioSettings.clip) : p_audioSettings;

            base.Init(audioSettings);
        }