示例#1
0
    IEnumerator Implode()
    {
        Vector3 startScale = target.transform.localScale;
        float   t          = 0;

        while (t < implodeDuration)
        {
            t += Time.fixedDeltaTime;
            target.transform.localScale = startScale - startScale * EZEasings.SmoothStop5(t / implodeDuration);

            yield return(new WaitForFixedUpdate());
        }

        Destroy(target.transform.root.gameObject);
    }
示例#2
0
 public static float GetSmoothStop5Range(Property p, float t)
 {
     return(p.start + (p.end - p.start) * EZEasings.SmoothStop5(t));
 }
示例#3
0
    IEnumerator GameOver()
    {
        float t = 0;

        while (exploding)
        {
            if (t < explodeDuration)
            {
                // Debug.Log("growing");
                t += Time.deltaTime;
                transform.localScale = Vector3.one + Vector3.one * targetScale * EZEasings.SmoothStart5(t / explodeDuration);
                yield return(new WaitForEndOfFrame());
            }
            else
            {
                exploding = false;
                waiting   = true;
            }
        }

        // wait at max scale
        t = 0;
        while (waiting)
        {
            if (t < waitDuration)
            {
                // Debug.Log("waiting");
                t += Time.deltaTime;
                yield return(new WaitForEndOfFrame());
            }
            else
            {
                waiting   = false;
                imploding = true;
            }
        }

        Vector3 largeScale = transform.localScale;

        t = 0;
        while (imploding)
        {
            if (t < implodeDuration)
            {
                // Debug.Log("imploding");
                t += Time.deltaTime;
                transform.localScale = largeScale - largeScale * EZEasings.SmoothStop5(t / implodeDuration);

                yield return(new WaitForEndOfFrame());
            }
            else
            {
                transform.localScale = Vector3.zero;
                imploding            = false;
            }
        }

        NewGameManager.GetInstance().ResetGame();

        Destroy(gameObject);
    }