void GlobalSpeedsGUI(PanelProfile profile)
    {
        if (profile.GetTransition(true) == null || profile.GetTransition(false) == null)
        {
            return;
        }

        bool openIsGlobal  = !profile.GetTransition(true).useLocalSpeed;
        bool closeIsGlobal = !profile.GetTransition(false).useLocalSpeed;

        if (openIsGlobal || closeIsGlobal)
        {
            GUILayout.Space(10);
            Label("Global Transition Multipliers", true, TextAnchor.MiddleLeft);

            if (openIsGlobal)
            {
                profile.openTransitionSpeed = EditorGUILayout.Slider("Open Speed Modifier", profile.openTransitionSpeed, 0.5f, 3.0f);
            }

            if (closeIsGlobal)
            {
                profile.closeTransitionSpeed = EditorGUILayout.Slider("Close Speed Modifier", profile.closeTransitionSpeed, 0.5f, 3.0f);
            }
        }
    }
    public override void OnInspectorGUI()
    {
        PanelProfile profile = (PanelProfile)target;

        if (profile == null)
        {
            return;
        }

        TransitionGUI(ref profile.openTransitionType, profile.GetTransition(true), true);
        GUILayout.Space(10);

        TransitionGUI(ref profile.closeTransitionType, profile.GetTransition(false), false);
        GlobalSpeedsGUI(profile);
        GUILayout.Space(10);

        SfxGUI(profile);
        EditorUtility.SetDirty(profile);
    }
Example #3
0
    IEnumerator PopRoutine(bool value, UnityAction action)
    {
        float t   = 0;
        int   way = value ? 1 : -1;

        var transition = profile.GetTransition(value);
        var curve      = value ? transition.openCurve : transition.closeCurve;

        if (way > 0)
        {
            GroupToggle(value);

            if (action != null)
            {
                action();
            }
        }

        var length = curve.keys.Length > 0 ? curve.keys[curve.keys.Length - 1].time : 0f;

        while (t < length)
        {
            transform.localScale = refSize * curve.Evaluate(t);
            yield return(new WaitForEndOfFrame());

            t += Time.unscaledDeltaTime * transition.speedModifier;
        }

        transform.localScale = refSize * curve.Evaluate(1.0f);

        if (way < 0)
        {
            GroupToggle(value);
            if (action != null)
            {
                action();
            }
        }

        transitionCorout = null;
    }