Exemplo n.º 1
0
    IEnumerator Deaccelerate()
    {
        yield return(new WaitForEndOfFrame());

        var   startSpeed = speed;
        var   startTime  = Time.time;
        float scale      = ExplodeSpeedScale;
        float delta      = ExplodeTime;

        while (Time.time - startTime < delta)
        {
            float a = (Time.time - startTime) / delta;
            var   s = Tween.CubicEaseOut(a, scale, 1, 1);
            speed = startSpeed * s;
            yield return(new WaitForEndOfFrame());
        }
        speed = startSpeed;
    }