Ejemplo n.º 1
0
    public static void ShowPopup(GameObject popup, Action callback = null)
    {
        // Reset button scale
        popup.ResetButtonScale(true);

        // Show popup
        popup.Show();

        // Fade-in
        popup.Play(FadeAction.FadeTo(popupEndOpacity, popupDuration));

        // Content
        GameObject content = popup.FindInChildren("Popup");

        if (content != null)
        {
            content.transform.localScale = popupStartScale;

            var zoomOut = ScaleAction.ScaleTo(popupEndScale, popupDuration * 0.7f);
            var zoomIn  = ScaleAction.ScaleTo(Vector3.one, popupDuration * 0.3f);
            var action  = SequenceAction.Create(zoomOut, zoomIn);

            content.Play(action, callback);
        }
        else
        {
            if (callback != null)
            {
                callback();
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        // Set scale
        transform.localScale = scale;

        gameObject.Play(ParallelAction.ParallelAll(ScaleAction.ScaleTo(scale * Random.Range(minScale, maxScale), scaleDuration), FadeAction.FadeOut(fadeDuration)), () => {
            GameObject.Destroy(gameObject);
        });
    }
Ejemplo n.º 3
0
    public void OnHint()
    {
        gameObject.StopAction("hint", true);

        var zoom   = ScaleAction.ScaleTo(hintScale, 0.1f, Ease.Linear, LerpDirection.PingPong);
        var action = RepeatAction.Create(zoom, 3, false);

        gameObject.Play(action).name = "hint";
    }
Ejemplo n.º 4
0
    public static BaseAction GetJellyAction()
    {
        var scale1   = ScaleAction.ScaleTo(new Vector3(1.1f, 0.9f, 1), 0.1f);
        var scale2   = ScaleAction.ScaleTo(new Vector3(0.9f, 1.1f, 1), 0.1f);
        var scale3   = ScaleAction.ScaleTo(new Vector3(1f, 1f, 1), 0.1f);
        var sequence = SequenceAction.Create(scale1, scale2, scale3);

        return(sequence);
    }
Ejemplo n.º 5
0
    void UpdateTime()
    {
        // Get current time
        int time = Mathf.CeilToInt(_time);

        if (time != _currentTime)
        {
            if (_currentTime > 0)
            {
                // Frame
                frame.StopAction();
                frame.Show();
                frame.Play(BlinkAction.Create(2, 0.3f, false, false), () => { frame.Hide(); });

                // Play effect
                GameObject effect = numberEffect.gameObject;
                effect.StopAction(true);
                effect.Show();
                effect.transform.localScale = Vector3.one;
                effect.SetColor(_currentTime > 3 ? Color.white : alarmColor, true);

                numberEffect.Number = _currentTime;

                var zoomOut = ScaleAction.ScaleTo(alarmScale, alarmDuration);
                var fadeOut = FadeAction.RecursiveFadeOut(alarmDuration);
                var hide    = HideAction.Create();

                effect.Play(SequenceAction.Create(ParallelAction.ParallelAll(zoomOut, fadeOut), hide));
            }

            // Set current time
            _currentTime = time;

            // Update number
            number.Number = time;
        }
    }