Пример #1
0
        void Update()
        {
            AudioSource audioComponent = GetComponent <AudioSource>();

            if (audioComponent.spatialize != wasSpatialized)
            {
                wasSpatialized = audioComponent.spatialize;
                Native.HelmSilence(GetChannel(), audioComponent.spatialize);
            }

            // Make sure AudioSource is setup correctly.
            if (Application.isPlaying && audioComponent.outputAudioMixerGroup == null)
            {
                if (!warnedNoAudioGroup)
                {
                    Debug.LogWarning("AudioSource output needs an AudioMixerGroup with a Helm Instance.");
                    warnedNoAudioGroup = true;
                }
            }
            else
            {
                warnedNoAudioGroup = false;
            }

            audioComponent.pitch        = 1.0f;
            audioComponent.dopplerLevel = 0.0f;
            if (sendAudioSource)
            {
                sendAudioSource.priority     = audioComponent.priority;
                sendAudioSource.volume       = audioComponent.volume;
                sendAudioSource.panStereo    = audioComponent.panStereo;
                sendAudioSource.spatialBlend = 0.0f;
            }
        }