﻿using ImpactCFX.EditorScripts;
using UnityEditor;

namespace ImpactCFX.MasterAudio.EditorScripts
{
    [CustomEditor(typeof(ImpactMasterAudioEffectAuthoring))]
    public class ImpactMasterAudioEffectAuthoringEditor : ImpactEffectAuthoringBaseEditor
    {
        private SerializedProperty collisionSoundGroupsProperty;
        private SerializedProperty collisionSoundGroupSelectionModeProperty;
        private SerializedProperty slideSoundGroupProperty;
        private SerializedProperty rollSoundGroupProperty;

        private SerializedProperty velocityReferenceRangeProperty;
        private SerializedProperty collisionNormalInfluenceProperty;
        private SerializedProperty scaleVolumeWithVelocityProperty;

        protected override void OnEnable()
        {
            base.OnEnable();

            velocityReferenceRangeProperty = serializedObject.FindProperty("velocityReferenceRange");
            scaleVolumeWithVelocityProperty = serializedObject.FindProperty("scaleVolumeWithVelocity");
            collisionNormalInfluenceProperty = serializedObject.FindProperty("collisionNormalInfluence");

            collisionSoundGroupsProperty = serializedObject.FindProperty("collisionSoundGroups");
            collisionSoundGroupSelectionModeProperty = serializedObject.FindProperty("soundGroupSelectionMode");
            slideSoundGroupProperty = serializedObject.FindProperty("slideSoundGroup");
            rollSoundGroupProperty = serializedObject.FindProperty("rollSoundGroup");
        }

        protected override void drawEffectProperties()
        {
            EditorGUILayout.PropertyField(collisionSoundGroupsProperty);
            EditorGUILayout.PropertyField(collisionSoundGroupSelectionModeProperty);

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(slideSoundGroupProperty);
            EditorGUILayout.PropertyField(rollSoundGroupProperty);

            ImpactEditorUtilities.Separator();

            EditorGUILayout.PropertyField(velocityReferenceRangeProperty);

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(scaleVolumeWithVelocityProperty);

            EditorGUILayout.Slider(collisionNormalInfluenceProperty, 0, 1);
        }
    }
}