/// <summary>
        /// Create a new AudioParameter and add it to the array of parameters
        /// </summary>
        /// <returns>The AudioParameter instance that was created</returns>
        public AudioParameter AddParameter()
        {
            AudioParameter newParameter = ScriptableObject.CreateInstance <AudioParameter>();

            newParameter.name = "New Audio Parameter";
            newParameter.InitializeParameter();
            AssetDatabase.AddObjectToAsset(newParameter, this);
            this.parameters.Add(newParameter);
            EditorUtility.SetDirty(this);
            AssetDatabase.SaveAssets();
            return(newParameter);
        }
        /// <summary>
        /// Check if any of the parameters on the event use gaze for the value
        /// </summary>
        /// <returns>Whether at least one parameter uses gaze</returns>
        private bool HasGazeProperty()
        {
            for (int i = 0; i < this.rootEvent.Parameters.Count; i++)
            {
                AudioParameter tempParam = this.rootEvent.Parameters[i].parameter;
                if (tempParam.UseGaze)
                {
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Set whether the defined parameter on the event uses the player's gaze angle
        /// </summary>
        /// <param name="toggle"></param>
        /// <param name="gazeParameter"></param>
        public void ToggleGaze(bool toggle, AudioParameter gazeParameter)
        {
            this.useGaze = toggle;

            if (!toggle)
            {
                for (int i = 0; i < this.activeParameters.Length; i++)
                {
                    ActiveParameter tempParameter = this.activeParameters[i];
                    if (tempParameter.rootParameter.parameter == gazeParameter)
                    {
                        tempParameter.Reset();
                    }
                }
            }
        }
        /// <summary>
        /// Set the value of a parameter on this event independent of the root parameter's value
        /// </summary>
        /// <param name="localParameter">The AudioParameter set on the root AudioEvent</param>
        /// <param name="newValue">The new local value on this event instance (does not set the AudioParameter value)</param>
        public void SetLocalParameter(AudioParameter localParameter, float newValue)
        {
            bool hasParameter = false;

            for (int i = 0; i < this.activeParameters.Length; i++)
            {
                ActiveParameter tempParameter = this.activeParameters[i];
                if (tempParameter.rootParameter.parameter == localParameter)
                {
                    hasParameter = true;
                    tempParameter.CurrentValue = newValue;
                }
            }

            if (!hasParameter)
            {
                //Debug.LogWarningFormat("Audio event {0} does not have parameter {1}", this.rootEvent.name, localParameter.name);
            }
        }
        /// <summary>
        /// Display the all of the parameters in the bank
        /// </summary>
        private void DrawParameterList()
        {
            this.parameterListRect.height = this.position.height / 2;
            GUILayout.BeginArea(this.parameterListRect);
            this.parameterListScrollPosition = EditorGUILayout.BeginScrollView(this.parameterListScrollPosition);

            if (this.audioBank == null)
            {
                EditorGUILayout.EndScrollView();
                GUILayout.EndArea();
                return;
            }

            if (GUILayout.Button("Add Parameter"))
            {
                this.audioBank.AddParameter();
            }

            if (this.audioBank.EditorParameters != null)
            {
                for (int i = 0; i < this.audioBank.EditorParameters.Count; i++)
                {
                    AudioParameter tempParameter = this.audioBank.EditorParameters[i];
                    if (tempParameter == null)
                    {
                        continue;
                    }

                    tempParameter.DrawParameterEditor();
                    if (GUILayout.Button("Delete Parameter"))
                    {
                        this.audioBank.DeleteParameter(tempParameter);
                    }
                    EditorGUILayout.Separator();
                }
            }
            EditorGUILayout.EndScrollView();
            GUILayout.EndArea();
        }
 /// <summary>
 /// Destroy an AudioParameter and remove it from the array of parameters
 /// </summary>
 /// <param name="parameterToDelete">The AudioParameter you wish to delete</param>
 public void DeleteParameter(AudioParameter parameterToDelete)
 {
     this.parameters.Remove(parameterToDelete);
     ScriptableObject.DestroyImmediate(parameterToDelete, true);
 }