示例#1
0
    IEnumerator An()
    {
        yield return(new WaitForSeconds(startOffset));

        while (true)
        {
            StartCoroutine(Anim.AnimateValue(0f, 0.5f, 0.5f, Anim.AccelerateDeccelerateInterpolator,
                                             (float value) =>
            {
                Color c = rend.color;
                c.a     = value;
                rend.SetColor(c);
            },
                                             (float value) =>
            {
                StartCoroutine(Anim.AnimateValue(0.5f, 0f, 0.5f, Anim.AccelerateDeccelerateInterpolator,
                                                 (float va) =>
                {
                    Color c = rend.color;
                    c.a     = va;
                    rend.SetColor(c);
                }, null));
            }
                                             ));
            yield return(Anim.AnimateValue(0.007f, 0.007f * 1.5f, 1f, Anim.OvershootInterpolator,
                                           (float value) =>
            {
                trans.SetSize(new Vector2(value, value));
            }, null));

            trans.SetSize(new Vector2(0.01f, 0.01f));
            yield return(new WaitForSeconds(0.1f));
        }
    }
示例#2
0
    IEnumerator Gen2()
    {
        while (true)
        {
            Destroy(SpawnBoxAt(spawnLeft.position), 7.3f);
            Destroy(SpawnBoxAt(spawnRight.position), 5f);
            Destroy(SpawnBoxAt(transform.position), 5f);
            yield return(new WaitForSeconds(3f));

            yield return(Anim.AnimateValue(-17f, 0f, 0.5f, Anim.AccelerateDeccelerateInterpolator,
                                           (float value) =>
            {
                plank.transform.rotation = Quaternion.Euler(0f, 0f, value);
            }, null));

            GameObject death1 = Instantiate(Resources.Load <GameObject>("Death"));
            death1.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Sprites/Pouss");
            death1.GetComponent <Trans>().SetPos(new Vector2(0f, 0.2f));
            yield return(new WaitForSeconds(1f));

            StartCoroutine(Anim.AnimateValue(0f, -17f, 0.5f, Anim.AccelerateDeccelerateInterpolator,
                                             (float value) =>
            {
                plank.transform.rotation = Quaternion.Euler(0f, 0f, value);
            }, null));
            Destroy(SpawnBoxAt(spawnLeft.position), 8f);
            Destroy(SpawnBoxAt(spawnRight.position), 5f);
            Destroy(SpawnBoxAt(transform.position), 5f);
            yield return(new WaitForSeconds(5.3f));
        }
    }
示例#3
0
    IEnumerator swag()
    {
        Vector3 size = transform.localScale;

        yield return(Anim.AnimateValue(1f, 2f, 1f, Anim.AccelerateDeccelerateInterpolator,
                                       (float value) =>
        {
            transform.localScale = size * value;
            float alpha = Mathf.Abs(value - 2f);
            sr.color = new Color(sr.color.r, sr.color.g, sr.color.b, alpha);
        }, null));

        Destroy(gameObject);
    }
示例#4
0
    public IEnumerator Resize(RectTransform obj)
    {
        StopCoroutine("Resize");
        Vector3 size = new Vector3(1f, 1f, 1f);

        yield return(Anim.AnimateValue(1f, 0.7f, 0.2f, Anim.AccelerateDeccelerateInterpolator,
                                       (float value, object o) =>
        {
            RectTransform rect = (RectTransform)o;
            rect.localScale = size * value;
        }, null, obj));

        yield return(Anim.AnimateValue(0.7f, 1f, 0.2f, Anim.AccelerateDeccelerateInterpolator,
                                       (float value, object o) =>
        {
            RectTransform rect = (RectTransform)o;
            rect.localScale = size * value;
        }, null, obj));
    }
示例#5
0
    IEnumerator An()
    {
        Vector2 size = trans.size;

        while (true)
        {
            yield return(Anim.AnimateValue(1f, 0.9f, 0.5f, Anim.AccelerateDeccelerateInterpolator,
                                           (float value) =>
            {
                trans.SetSize(size * value);
            }, null));

            yield return(Anim.AnimateValue(0.9f, 1f, 0.5f, Anim.AccelerateDeccelerateInterpolator,
                                           (float value) =>
            {
                trans.SetSize(size * value);
            }, null));
        }
    }