예제 #1
0
    private void _DisplaySubItem_Clip(SoundSubItem subItem, int subItemCount, SoundItem curItem)
    {
        if (subItem != null)
        {
            UnityEngine.Object clip = subItem.Clip;
            EditAudioClip(ref clip, "Audio Clip");
            subItem.Clip = clip;

            if (EditFloat01(ref subItem.Volume, "Volume", " %"))
            {
                _AdjustVolumeOfAllAudioItems(curItem, subItem);
            }

            EditFloat01(ref subItem.RandomVolume, "Random Volume", "±%");

            EditFloat(ref subItem.Delay, "Delay", "sec");
            EditFloatPlusMinus1(ref subItem.Pan2D, "Pan2D", "%left/right");
            if (_IsRandomItemMode(curItem.SubItemPickMode))
            {
                EditFloat01(ref subItem.Probability, "Probability", " %", "Choose a higher value (in comparison to the probability values of the other audio clips) to increase the probability for this clip when using a random subitem pick mode.");
            }
            EditFloat(ref subItem.PitchShift, "Pitch Shift", "semitone");
            EditFloat(ref subItem.RandomPitch, "Random Pitch", "±semitone");
            EditFloat(ref subItem.RandomDelay, "Random Delay", "sec");
            EditFloat(ref subItem.FadeIn, "FadeIn", "sec");
            EditFloat(ref subItem.FadeOut, "FadeOut", "sec");
        }

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label(" ");
        GUI.enabled = _IsAudioControllerInPlayMode();

        if (GUILayout.Button("Play", GUILayout.Width(60)) && subItem != null)
        {
            if (_IsAudioControllerInPlayMode())
            {
                var     audioListener = SoundsManager.GetCurrentAudioListener();
                Vector3 pos;
                if (audioListener != null)
                {
                    pos = audioListener.transform.position + audioListener.transform.forward;
                }
                else
                {
                    pos = Vector3.zero;
                }

                AC.PlayAudioSubItem(subItem.Item.Category, curItem, subItem, pos, null, false, null, null);
            }
        }

        GUI.enabled = true;
        EditorGUILayout.EndHorizontal();
    }