示例#1
0
        private void CreateExtensionEditors()
        {
            if (this.m_SpatializerEditor != null)
            {
                this.DestroyExtensionEditors();
            }
            Type sourceSpatializerExtensionEditorType = AudioExtensionManager.GetSourceSpatializerExtensionEditorType();

            this.m_SpatializerEditor = (ScriptableObject.CreateInstance(sourceSpatializerExtensionEditorType) as AudioSourceExtensionEditor);
            if (this.m_SpatializerEditor != null)
            {
                for (int i = 0; i < base.targets.Length; i++)
                {
                    AudioSource audioSource = base.targets[i] as AudioSource;
                    if (audioSource != null)
                    {
                        Undo.RecordObject(audioSource, "Add AudioSource extension properties");
                        string name = AudioExtensionManager.GetSourceSpatializerExtensionType().Name;
                        for (int j = 0; j < this.m_SpatializerEditor.GetNumExtensionProperties(); j++)
                        {
                            PropertyName extensionPropertyName = this.m_SpatializerEditor.GetExtensionPropertyName(j);
                            float        propertyValue         = 0f;
                            if (!audioSource.ReadExtensionProperty(name, extensionPropertyName, ref propertyValue))
                            {
                                propertyValue = this.m_SpatializerEditor.GetExtensionPropertyDefaultValue(j);
                                audioSource.WriteExtensionProperty(AudioExtensionManager.GetSourceSpatializerExtensionName(), name, extensionPropertyName, propertyValue);
                            }
                        }
                    }
                }
            }
            this.m_AddSpatializerExtensionMixedValues = false;
        }
示例#2
0
        // Created editors for all the enabled extensions of this AudioSource.
        private void CreateExtensionEditors()
        {
            if (m_SpatializerEditor != null)
            {
                DestroyExtensionEditors();
            }

            System.Type spatializerEditorType = AudioExtensionManager.GetSourceSpatializerExtensionEditorType();
            m_SpatializerEditor = ScriptableObject.CreateInstance(spatializerEditorType) as AudioSourceExtensionEditor;

            if (m_SpatializerEditor != null)
            {
                for (int i = 0; i < targets.Length; i++)
                {
                    AudioSource source = targets[i] as AudioSource;
                    if (source != null)
                    {
                        Undo.RecordObject(source, "Add AudioSource extension properties");
                        string extensionName = AudioExtensionManager.GetSourceSpatializerExtensionType().Name;
                        for (int j = 0; j < m_SpatializerEditor.GetNumExtensionProperties(); j++)
                        {
                            PropertyName propertyName = m_SpatializerEditor.GetExtensionPropertyName(j);
                            float        value        = 0.0f;

                            // If the AudioSource is missing an extension property, then create it now.
                            if (!source.ReadExtensionProperty(extensionName, propertyName, ref value))
                            {
                                value = m_SpatializerEditor.GetExtensionPropertyDefaultValue(j);
                                source.WriteExtensionProperty(AudioExtensionManager.GetSourceSpatializerExtensionName(), extensionName, propertyName, value);
                            }
                        }
                    }
                }
            }

            m_AddSpatializerExtensionMixedValues = false;
        }
示例#3
0
 private void DestroyExtensionEditors()
 {
     DestroyImmediate(m_SpatializerEditor);
     m_SpatializerEditor = null;
 }
示例#4
0
 private void DestroyExtensionEditors()
 {
     UnityEngine.Object.DestroyImmediate(this.m_SpatializerEditor);
     this.m_SpatializerEditor = null;
 }