Beispiel #1
0
    private void InitAnimations()
    {
        AnimationOperation fadeOperation = new AnimationOperation(panel, UIAnimationType.Fade, EaseType.SmoothStepSmoother, 0, 0.5f)
        {
            fadeSettings = new AnimationOperation.FadeSettings {
                startAlpha  = 0,
                targetAlpha = 1
            }
        };

        showAnimation = new AnimationSequence(e => StartCoroutine(e));
        showAnimation.AddOperation(fadeOperation, new AnimationOperation {
            targetObject = panel, type = UIAnimationType.Activate, activate = true
        });
        resumeButton.SelectOnShow = true;
        showAnimation.OnFinished(() => {
            resumeButton.Show(true, false);
            quitButton.Show(true, false);
        });

        hideAnimation = new AnimationSequence(e => StartCoroutine(e));
        hideAnimation.AddOperation(fadeOperation.Reversed(), new AnimationOperation {
            targetObject = panel, type = UIAnimationType.Activate, activate = false, delay = 0.5f
        });
    }
    private void ShowMessage(string message)
    {
        trainerMessageText.text = message;

        AnimationOperation scaleOperation = new AnimationOperation(messagePanel, UIAnimationType.Scale, EaseType.SmoothStepSmoother, 0, 1f)
        {
            scaleSettings = new AnimationOperation.ScaleSettings {
                startScale  = Vector3.zero,
                targetScale = Vector3.one
            }
        };

        AnimationOperation fadeOperation = new AnimationOperation(messagePanel, UIAnimationType.Fade, EaseType.SmoothStepSmoother, 0, 1f)
        {
            fadeSettings = new AnimationOperation.FadeSettings {
                startAlpha  = 0,
                targetAlpha = 1
            }
        };

        AnimationOperation flipOperation = new AnimationOperation(messagePanel, UIAnimationType.Rotate, EaseType.SmoothStepSmoother, 0, 0.5f)
        {
            rotateSettings = new AnimationOperation.RotateSettings {
                startEuler  = Vector3.zero,
                targetEuler = new Vector3(90, 0, 0)
            }
        };

        AnimationSequence showMessageAnimation = new AnimationSequence(e => StartCoroutine(e));

        showMessageAnimation.AddOperation(scaleOperation, fadeOperation, new AnimationOperation {
            targetObject = messagePanel, type = UIAnimationType.Activate, activate = true
        });
        showMessageAnimation.AddDelay(2f);
        showMessageAnimation.AddOperation(new AnimationOperation(fadeOperation.Reversed())
        {
            duration = 0.5f
        }, flipOperation, new AnimationOperation {
            targetObject = messagePanel, type = UIAnimationType.Activate, activate = false, delay = 0.5f
        }, new AnimationOperation {
            targetObject = messagePanel, type = UIAnimationType.Rotate, rotateSettings = new AnimationOperation.RotateSettings {
                targetEuler = Vector3.zero
            }, delay = 0.5f
        });

        showMessageAnimation.Play();
    }
    private void SetMultiplier(int combo, bool animated)
    {
        int multiplier = GetScoreMultiplier(combo);

        if (animated)
        {
            if (multiplierAnimation == null && multiplier == 2)
            {
                scaleOperation = new AnimationOperation(multiplierText.gameObject, UIAnimationType.Scale, EaseType.SmoothStepSmoother, 0, 0.5f)
                {
                    scaleSettings = new AnimationOperation.ScaleSettings {
                        startScale  = Vector3.one,
                        targetScale = Vector3.one * 1.25f
                    }
                };
                reversedScaleOperation       = scaleOperation.Reversed();
                reversedScaleOperation.delay = 0.5f;

                multiplierAnimation = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);
                multiplierAnimation.AddOperation(scaleOperation);
                multiplierAnimation.AddOperation(reversedScaleOperation);
                multiplierAnimation.Loop();

                multiplierAnimation.Play();

                Show();
            }

            if (multiplier < currentMultiplier)
            {
                Hide();
            }

            multiplierText.text = $"x {multiplier}";
            currentCombo        = combo;
            currentMultiplier   = multiplier;
        }
        else
        {
            multiplierText.text = $"x {multiplier}";
            currentCombo        = combo;
            currentMultiplier   = multiplier;

            ShowHudElement(multiplier > 1, false);
        }
    }
 private void InitAnimations() {
     AnimationOperation scaleContentOperation = new AnimationOperation(content, UIAnimationType.Scale, EaseType.SmoothStepSmoother, 0, 0.5f) {
         scaleSettings = new AnimationOperation.ScaleSettings {
             startScale = Vector3.zero,
             targetScale = Vector3.one
         }
     };
     AnimationOperation fadeContentOperation = new AnimationOperation(content, UIAnimationType.Fade, EaseType.SmoothStepSmoother, 0, 0.5f) {
         fadeSettings = new AnimationOperation.FadeSettings {
             startAlpha = 0,
             targetAlpha = 1
         }
     };
     AnimationOperation fadeBackgroundOperation = new AnimationOperation(fadeContentOperation) {targetObject = background};
         
     showAnimation = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);
     showAnimation.AddOperation(scaleContentOperation, fadeContentOperation, fadeBackgroundOperation, new AnimationOperation {targetObject = panel, type = UIAnimationType.Activate, activate = true});
     showAnimation.OnFinished(() => confirmButton.Select());
     
     hideAnimation = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);
     hideAnimation.AddOperation(scaleContentOperation.Reversed(), fadeContentOperation.Reversed(), fadeBackgroundOperation.Reversed(), new AnimationOperation{targetObject = panel, type = UIAnimationType.Activate, activate = false, delay = 0.5f});
 }
Beispiel #5
0
    private void Awake()
    {
        ShowOverview(false, false);

        backButton.onPress.AddListener(Back);

        backgroundShowAnimation = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);
        backgroundHideAnimation = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);

        AnimationOperation fadeOperation = new AnimationOperation(background, UIAnimationType.Fade, EaseType.SmoothStepSmoother, 0, 0.5f)
        {
            fadeSettings = new AnimationOperation.FadeSettings {
                startAlpha = 0, targetAlpha = 1
            }
        };

        backgroundShowAnimation.AddOperation(fadeOperation, new AnimationOperation {
            targetObject = background, type = UIAnimationType.Activate, activate = true
        });
        backgroundHideAnimation.AddOperation(fadeOperation.Reversed(), new AnimationOperation {
            targetObject = background, type = UIAnimationType.Activate, activate = false, delay = fadeOperation.duration
        });
    }
    private void InitAnims()
    {
        showAnim = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);

        AnimationOperation activateOperation = new AnimationOperation(panel, UIAnimationType.Activate, EaseType.None, fadeScreenDuration, 0)
        {
            activate = true
        };
        AnimationOperation fadeOperation = new AnimationOperation(panel, UIAnimationType.Fade, EaseType.SmoothStepSmoother, 0, 1f)
        {
            fadeSettings = new AnimationOperation.FadeSettings {
                startAlpha  = 0,
                targetAlpha = 1
            }
        };

        showAnim.AddOperation(activateOperation, fadeOperation);

        hideAnim = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);
        AnimationOperation deactivateOperation = new AnimationOperation(panel, UIAnimationType.Activate, EaseType.None, 1, 0)
        {
            activate = false
        };

        hideAnim.AddOperation(new AnimationOperation(fadeOperation.Reversed()), deactivateOperation);
        hideAnim.OnFinished(() => {
            progressBarFill.fillAmount = 0;
            if (progressRoutine != null)
            {
                applicationEventRelay.RequestStoppingCoroutine(progressRoutine);
            }
            barCurrentTargetValue = 0;
        });

        textBlinkAnim = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);
        AnimationOperation blinkOperation = new AnimationOperation(fadeOperation)
        {
            targetObject = loadingText.gameObject
        };

        textBlinkAnim.AddOperation(blinkOperation);
        textBlinkAnim.PingPong();
        textBlinkAnim.Loop();

        AnimationOperation spinningOperation1 = new AnimationOperation(tennisBallImage, UIAnimationType.Rotate, EaseType.Linear, 0, 4f)
        {
            rotateSettings = new AnimationOperation.RotateSettings {
                startEuler  = new Vector3(0, 0, 0),
                targetEuler = new Vector3(0, 0, 180)
            }
        };
        AnimationOperation spinningOperation2 = new AnimationOperation(tennisBallImage, UIAnimationType.Rotate, EaseType.Linear, 3.95f, 4f)
        {
            rotateSettings = new AnimationOperation.RotateSettings {
                startEuler  = new Vector3(0, 0, 180),
                targetEuler = new Vector3(0, 0, 360)
            }
        };

        spinningBallAnim = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine);
        spinningBallAnim.AddOperation(spinningOperation1, spinningOperation2);
        spinningBallAnim.Loop();
    }