Ejemplo n.º 1
0
        private void ShowDelayBlock()
        {
            actionsScript.isDelayed = EditorGUILayout.ToggleLeft("Delayed", actionsScript.isDelayed);

            if (actionsScript.isDelayed)
            {
                if (!actionsScript.isDelayRandom)
                {
                    GUILayout.BeginHorizontal();
                    actionsScript.delayTime = EditorGUILayout.FloatField(actionsScript.delayTime);
                    Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.delayTime);
                    EditorGUILayout.LabelField("[s]");
                    GUILayout.EndHorizontal();
                }

                else
                {
                    GUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Min", GUILayout.MaxWidth(50));
                    actionsScript.delayRange[0] = EditorGUILayout.FloatField(actionsScript.delayRange[0]);
                    Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.delayRange[0]);
                    EditorGUILayout.LabelField("[s]");
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Max", GUILayout.MaxWidth(50));
                    actionsScript.delayRange[1] = EditorGUILayout.FloatField(actionsScript.delayRange[1]);
                    Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.delayRange[1]);
                    EditorGUILayout.LabelField("[s]");
                    GUILayout.EndHorizontal();

                    if (actionsScript.delayRange[1] < actionsScript.delayRange[0])
                    {
                        actionsScript.delayRange[1] = actionsScript.delayRange[0] + 1.0f;
                    }
                }

                GUILayout.BeginHorizontal();
                actionsScript.isDelayRandom = EditorGUILayout.ToggleLeft("Random", actionsScript.isDelayRandom);
                GUILayout.EndHorizontal();

//                GUILayout.BeginHorizontal();
//                actionsScript.multipleActionsInTime = EditorGUILayout.ToggleLeft("Fire All Interactions Recorded During Delay", actionsScript.multipleActionsInTime);
//                GUILayout.EndHorizontal();
            }
        }
Ejemplo n.º 2
0
        private void DisplayReloadDelayBlock()
        {
            EditorGUILayout.LabelField("Delay");

            GUILayout.BeginVertical();

            if (!targetConditions.isReloadRandom)
            {
                GUILayout.BeginHorizontal();
                targetConditions.reloadDelay = EditorGUILayout.FloatField(targetConditions.reloadDelay);
                Gaze_Utils.EnsureFieldIsPositiveOrZero(ref targetConditions.reloadDelay);
                EditorGUILayout.LabelField("[s]");
                GUILayout.EndHorizontal();
            }

            else
            {
                GUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Min", GUILayout.MaxWidth(50));
                targetConditions.reloadRange[0] = EditorGUILayout.FloatField(targetConditions.reloadRange[0]);
                Gaze_Utils.EnsureFieldIsPositiveOrZero(ref targetConditions.reloadRange[0]);
                EditorGUILayout.LabelField("[s]");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Max", GUILayout.MaxWidth(50));
                targetConditions.reloadRange[1] = EditorGUILayout.FloatField(targetConditions.reloadRange[1]);
                Gaze_Utils.EnsureFieldIsPositiveOrZero(ref targetConditions.reloadRange[1]);
                EditorGUILayout.LabelField("[s]");
                GUILayout.EndHorizontal();

                if (targetConditions.reloadRange[1] < targetConditions.reloadRange[0])
                {
                    targetConditions.reloadRange[1] = targetConditions.reloadRange[0] + 1.0f;
                }
            }

            GUILayout.BeginHorizontal();
            targetConditions.isReloadRandom = EditorGUILayout.ToggleLeft("Random", targetConditions.isReloadRandom);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
Ejemplo n.º 3
0
        public void ShowAudioOptions()
        {
            #region AudioSource

            actionsScript.ActionAudio = (Gaze_Actions.ACTIVABLE_OPTION)EditorGUILayout.EnumPopup(new GUIContent("Audio", "Launch a sound using this action."), actionsScript.ActionAudio);

            if (actionsScript.ActionAudio != Gaze_Actions.ACTIVABLE_OPTION.NOTHING)
            {
                EditorGUILayout.BeginVertical();
                if (hierarchyAudioSources.Count > 0)
                {
                    Gaze_EditorUtils.DrawSectionTitle("Audio Setup");
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(new GUIContent("Audio Source", "Select the audiosource you want to use to play your audio if you have many on your IO"));

                    if (!hierarchyAudioSources.Contains(actionsScript.targetAudioSource))
                    {
                        actionsScript.targetAudioSource = hierarchyAudioSources[0];
                    }

                    actionsScript.targetAudioSource = hierarchyAudioSources[EditorGUILayout.Popup(hierarchyAudioSources.IndexOf(actionsScript.targetAudioSource), hierarchyAudioSourceNames.ToArray())];

                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    EditorGUILayout.HelpBox("No audio sources found.", MessageType.Warning);
                }
                EditorGUILayout.EndVertical();

                #endregion AudioSource

                #region AudioClips
                if (actionsScript.ActionAudio == Gaze_Actions.ACTIVABLE_OPTION.ACTIVATE)
                {
                    actionsScript.activeTriggerStatesAudio[0] = EditorGUILayout.ToggleLeft(Gaze_HashIDs.TriggerEventsAndStates[0], actionsScript.activeTriggerStatesAudio[0]);

                    if (actionsScript.activeTriggerStatesAudio[0])
                    {
                        DisplayAudioBlock(0);
                    }

                    EditorGUI.indentLevel++;
                    ShowOtherAudioOptions = EditorGUILayout.Foldout(ShowOtherAudioOptions, "More Options:");

                    if (ShowOtherAudioOptions)
                    {
                        for (int i = 1; i < Gaze_HashIDs.TriggerEventsAndStates.Length; i++)
                        {
                            actionsScript.activeTriggerStatesAudio[i] = EditorGUILayout.ToggleLeft(new GUIContent(Gaze_HashIDs.TriggerEventsAndStates[i], AudioTriggerEvensAndStatesHints[i]), actionsScript.activeTriggerStatesAudio[i]);
                            if (actionsScript.activeTriggerStatesAudio[i])
                            {
                                DisplayAudioBlock(i);
                            }
                        }
                    }

                    EditorGUI.indentLevel--;
                    EditorGUILayout.Space();

                    Gaze_EditorUtils.DrawSectionTitle("Audio Parameters");

                    actionsScript.audio_stopOthers = EditorGUILayout.ToggleLeft(new GUIContent("Stop Other Audios", "Stops any others audios launched by this IO only"), actionsScript.audio_stopOthers);

                    // Randomize Pitch
                    actionsScript.audio_randomizePitch = EditorGUILayout.ToggleLeft(new GUIContent("Randomize pitch", "Change the pitch of this interaction only"), actionsScript.audio_randomizePitch);
                    if (actionsScript.audio_randomizePitch)
                    {
                        actionsScript.audio_minPitch = EditorGUILayout.FloatField("Min pitch", actionsScript.audio_minPitch, GUILayout.Width(300));
                        Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.audio_minPitch);
                        actionsScript.audio_maxPitch = EditorGUILayout.FloatField("Max pitch", actionsScript.audio_maxPitch, GUILayout.Width(300));
                        Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.audio_maxPitch);
                    }
                    // End of Randomize Pitch

                    #endregion onAfter


                    #region Fade In
                    GUILayout.BeginHorizontal();
                    actionsScript.fadeInEnabled = EditorGUILayout.ToggleLeft("Fade In", actionsScript.fadeInEnabled);
                    if (actionsScript.fadeInEnabled)
                    {
                        actionsScript.fadeInTime = EditorGUILayout.FloatField("", actionsScript.fadeInTime, GUILayout.Width(100));
                        Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.fadeInTime);
                        EditorGUILayout.LabelField("[s]");
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();

                        actionsScript.fadeInCurve = EditorGUILayout.CurveField(actionsScript.fadeInCurve, Color.green, new Rect(0, 0, actionsScript.fadeInTime, 1), GUILayout.Width(400));
                    }
                    GUILayout.EndHorizontal();
                    if (actionsScript.DontHaveAudioLoop())
                    {
                        GUILayout.BeginHorizontal();
                        actionsScript.fadeOutEnabled = EditorGUILayout.ToggleLeft("Fade Out", actionsScript.fadeOutEnabled);
                        if (actionsScript.fadeOutEnabled)
                        {
                            actionsScript.fadeOutTime = EditorGUILayout.FloatField("", actionsScript.fadeOutTime, GUILayout.Width(100));
                            Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.fadeOutTime);
                            EditorGUILayout.LabelField("[s]");
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();

                            actionsScript.fadeOutCurve = EditorGUILayout.CurveField(actionsScript.fadeOutCurve, Color.green, new Rect(0, 0, actionsScript.fadeOutTime, 1), GUILayout.Width(400));
                        }
                        GUILayout.EndHorizontal();

                        #endregion

                        #region Ducking
                        if (actionsScript.ActionAudio == Gaze_Actions.ACTIVABLE_OPTION.ACTIVATE)
                        {
                            actionsScript.duckingEnabled = EditorGUILayout.ToggleLeft(new GUIContent("Ducking", "The volume rises when this IO is Gazed"), actionsScript.duckingEnabled);
                            if (actionsScript.duckingEnabled)
                            {
                                DisplayAudioDuckingBlock();
                            }
                            else
                            {
                                DisplayAudioVolume();
                            }
                        }
                        #endregion
                    }

                    EditorGUILayout.Space();
                    Gaze_EditorUtils.DrawSectionTitle("Audio Reload Parameters");
                    Gaze_EditorUtils.DrawEditorHint("By default audios will wait until the last one is finished when reloaded");
                    EditorGUILayout.Space();

                    actionsScript.audio_ForceStop = EditorGUILayout.ToggleLeft(new GUIContent("Immediate play", "Stops others audios launched with this interaction when reloaded."), actionsScript.audio_ForceStop);
                    if (!actionsScript.audio_ForceStop)
                    {
                        actionsScript.audio_AllowMultiple = EditorGUILayout.ToggleLeft(new GUIContent("Cumulate audios", "Cumulates audios launched with this interaction when reloaded."), actionsScript.audio_AllowMultiple);

                        if (actionsScript.audio_AllowMultiple)
                        {
                            actionsScript.audio_MaxConcurrentSound = EditorGUILayout.IntField("Max concurrent audios", actionsScript.audio_MaxConcurrentSound);
                        }
                    }
                }

                if (actionsScript.ActionAudio == Gaze_Actions.ACTIVABLE_OPTION.DEACTIVATE)
                {
                    #region Fade Out
                    GUILayout.BeginHorizontal();
                    actionsScript.fadeOutDeactEnabled = EditorGUILayout.ToggleLeft("Fade Out", actionsScript.fadeOutDeactEnabled);

                    if (actionsScript.fadeOutDeactEnabled)
                    {
                        actionsScript.fadeOutDeactTime = EditorGUILayout.FloatField("", actionsScript.fadeOutDeactTime, GUILayout.Width(200));
                        Gaze_Utils.EnsureFieldIsPositiveOrZero(ref actionsScript.fadeOutDeactTime);
                        EditorGUILayout.LabelField("[s]");
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();

                        actionsScript.fadeOutDeactCurve = EditorGUILayout.CurveField(actionsScript.fadeOutDeactCurve, Color.green, new Rect(0, 0, actionsScript.fadeOutDeactTime, 1), GUILayout.Width(400));
                    }
                    GUILayout.EndHorizontal();
                    #endregion
                }
            }
        }