Example #1
0
    private void updateFromWhiteToGoL()
    {
        if (tweener == null)
        {
            return;
        }
        var value = tweener.UpdateValue(Time.deltaTime);

        GoFRender.TextureLerp = value;

        if (value >= 1)
        {
            update  = null;
            tweener = null;
        }
    }
Example #2
0
    private void updateFromWhiteToBlack()
    {
        if (tweener == null)
        {
            return;
        }
        var value = tweener.UpdateValue(Time.deltaTime);

        GoFRender.InverseColor = value;

        if (value <= 0)
        {
            update  = null;
            tweener = null;
        }
    }
Example #3
0
    private void updateFromBlackToWhite()
    {
        if (tweener == null)
        {
            return;
        }
        var value = tweener.UpdateValue(Time.deltaTime);

        GoFRender.InverseColor = value;
        GoFRender.Saturation   = SaturationUnderSlide + (1 - SaturationUnderSlide) * (1 - value);

        if (value >= 1)
        {
            update  = null;
            tweener = null;
        }
    }
    public override void Show(float fade, TransitionDirection direction, SimpleTween.Callback callback)
    {
        // don't animate the elements if we're returning to this screen from a submenu.
        if (direction == TransitionDirection.Forward)
        {
            // get the distance and credits values.
            float distance    = GameManager.LevelManager.TotalDistance;
            float record      = GameManager.RecordDistance;
            int   creditScore = GameManager.CreditsThisRace;

            if (distance == record)
            {
                // this is a new record, so show the newRecordScreen elements
                normalScreen.alpha    = 0.0f;
                newRecordScreen.alpha = 1.0f;

                // animate the distance text up from 0, then kick the scale at the end for effect.
                SimpleTweener.AddTween(() => 0, x => newRecordText.text = Mathf.CeilToInt(x).ToString() + "m", record, 0.5f).Delay(0.2f).OnCompleted(() => {
                    KickItem(newRecordText.transform, 1.5f, 0.5f);
                });
                SimpleTweener.AddTween(() => 0, x => creditScoreText.text = "+" + x, creditScore, 0.5f).Delay(0.7f).OnCompleted(() => {
                    KickItem(creditScoreText.transform, 1.5f, 0.3f);
                });
            }
            else
            {
                // no new record, so show the normalScreen elements
                normalScreen.alpha    = 1.0f;
                newRecordScreen.alpha = 0.0f;

                // animate the text up from 0, then kick the scale at the end for effect.
                SimpleTweener.AddTween(() => 0, x => distanceText.text = Mathf.CeilToInt(x).ToString() + "m", distance, 0.5f).Delay(0.2f).OnCompleted(() => {
                    KickItem(distanceText.transform, 1.5f, 0.3f);
                });
                SimpleTweener.AddTween(() => 0, x => oldRecordText.text = Mathf.CeilToInt(x).ToString() + "m", record, 0.5f).Delay(0.5f).OnCompleted(() => {
                    KickItem(oldRecordText.transform, 1.5f, 0.3f);
                });
                SimpleTweener.AddTween(() => 0, x => creditScoreText.text = "+" + x, creditScore, 0.5f).Delay(1.0f).OnCompleted(() => {
                    KickItem(creditScoreText.transform, 1.5f, 0.3f);
                });
            }
        }

        base.Show(fade, direction, callback);
    }
Example #5
0
    public void KillEffects()
    {
        var shafts = GetComponent<SunShafts>();
        if (shafts != null) {
            originalSunIntensity = shafts.sunShaftIntensity;
        }
        var blur = GetComponent<MotionBlur>();
        if (blur != null) {
            originalBlurAmount = blur.blurAmount;
        }
        var dof = GetComponent<DepthOfFieldScatter>();
        if (dof != null)
        {
            originalAperture = dof.aperture;
        }

        tweener = new SimpleTweener(1, 0, EffectClearTime, SimpleTweener.EaseType.easeOutCubic);
    }
Example #6
0
    public override void ApplyPowerup()
    {
        // display a powerup message on screen
        string msg = infoText + " +" + creditBonus;

        GameManager.ShowCountdown(msg, boostTime, fadeInTime);
        // award the player some credits
        GameManager.AwardCredits(creditBonus);

        // animate up the speed of the player, wait for our duration, then animate it back down again.
        PlayerControl player = GameManager.Player;

        tween = SimpleTweener.AddTween(() => player.SpeedMultiplier, x => player.SpeedMultiplier = x, boostAmount, fadeInTime).OnCompleted(() => {
            tween = SimpleTweener.AddTween(() => player.SpeedMultiplier, x => player.SpeedMultiplier = x, 1.0f, fadeOutTime).Delay(boostTime).OnCompleted(() => {
                PowerupManager.OnPowerupCompleted(this);
            });
        });
    }
Example #7
0
    /// <summary>
    /// Show a message along with a countdown
    /// </summary>
    /// <param name="message">The message to display</param>
    /// <param name="duration">The duration to display it for (also the duration of the countdown)</param>
    /// <param name="fadeTime">The transition in/out time.</param>
    public void ShowCountdown(string message, float duration, float fadeTime)
    {
        // if we are still showing a previous countdown, then cancel the previous tween
        if (isShowing)
        {
            SimpleTweener.RemoveTween(countdownTween);
        }

        // set the message text
        text.text = message;
        // make the countdown graphic visible
        countdown.alpha = 1.0f;

        // animate the countdown progress by scaling the progress graphic
        countdownTween = SimpleTweener.AddTween(() => Vector3.one, x => countdownProgress.localScale = x, new Vector3(0.0f, 1.0f, 1.0f), duration).Delay(fadeTime).Ease(Easing.EaseLinear);
        // animate the whole info panel
        ShowInfoPopup(duration, fadeTime);
    }
Example #8
0
    private void Update()
    {
        if (tweener != null) {
            var value = tweener.UpdateValue(Time.deltaTime);
            var shafts = GetComponent<SunShafts>();
            if (shafts != null) {
                shafts.sunShaftIntensity = originalSunIntensity*value;
            }
            var blur = GetComponent<MotionBlur>();
            if (blur != null) {
                blur.blurAmount = originalBlurAmount*value;
            }
            var dof = GetComponent<DepthOfFieldScatter>();
            if (dof != null)
            {
                dof.aperture = originalAperture * value;
            }

            if (value <= 0) {
                tweener = null;
            }
        }
    }
Example #9
0
    public void KillEffects()
    {
        var shafts = GetComponent <SunShafts>();

        if (shafts != null)
        {
            originalSunIntensity = shafts.sunShaftIntensity;
        }
        var blur = GetComponent <MotionBlur>();

        if (blur != null)
        {
            originalBlurAmount = blur.blurAmount;
        }
        var dof = GetComponent <DepthOfFieldScatter>();

        if (dof != null)
        {
            originalAperture = dof.aperture;
        }

        tweener = new SimpleTweener(1, 0, EffectClearTime, SimpleTweener.EaseType.easeOutCubic);
    }
Example #10
0
 private void KickItem(Transform item, float amount, float time)
 {
     // animate the scale of an item to give it a little 'kick'
     SimpleTweener.AddTween(() => item.localScale, x => item.localScale = x, amount * item.localScale, time).Ease(Easing.EaseKick);
 }
Example #11
0
    private void updateFromWhiteToGoL()
    {
        if (tweener == null) return;
        var value = tweener.UpdateValue(Time.deltaTime);

        GoFRender.TextureLerp = value;

        if (value >= 1)
        {
            update = null;
            tweener = null;
        }
    }
Example #12
0
    private void updateFromWhiteToBlack()
    {
        if (tweener == null) return;
        var value = tweener.UpdateValue(Time.deltaTime);

        GoFRender.InverseColor = value;

        if (value <= 0) {
            update = null;
            tweener = null;
        }
    }
Example #13
0
    private void updateFromBlackToWhite()
    {
        if (tweener == null) return;
        var value = tweener.UpdateValue(Time.deltaTime);

        GoFRender.InverseColor = value;
        GoFRender.Saturation = SaturationUnderSlide + (1 - SaturationUnderSlide)*(1-value);

        if (value >= 1)
        {
            update = null;
            tweener = null;
        }
    }
 // Use this for initialization
 void Start()
 {
     _tweener = new SimpleTweener(0, 1, moveTime, SimpleTweener.EaseType.linear);
 }