Esempio n. 1
0
    IEnumerator FadeOutAndLoad(string sceneName, float animationTime, float waitTime, Action callback = null)
    {
        fadeCanvasGroup.alpha = 0;
        if (loadingText != null)
        {
            loadingText.gameObject.SetActive(true);
        }
        yield return(this.DoUnscaledTween01(t =>
        {
            if (music != null)
            {
                music.volume = PennerAnimation.CubicEaseOut(t, 0, 1, 1);
            }
            fadeCanvasGroup.alpha = PennerAnimation.QuadEaseInOut(t, 0, 1, 1);
        }, animationTime, () =>
        {
            callback?.Invoke();
        }));

        fadeCanvasGroup.alpha = 1.0f;
        if (music != null)
        {
            music.volume = 0;
        }
        if (waitTime > 0)
        {
            yield return(new WaitForSeconds(waitTime));
        }

        SceneManager.LoadScene(sceneName);
    }
Esempio n. 2
0
    IEnumerator FadeIn(float animationTime)
    {
        fadeCanvasGroup.alpha = 1.0f;
        yield return(new WaitForSeconds(fadeInDelay));

        yield return(this.DoTween01(t =>
        {
            fadeCanvasGroup.alpha = PennerAnimation.QuadEaseInOut(t, 1, -1, 1);
        }, animationTime));
    }
Esempio n. 3
0
    public static IEnumerator Translate(Transform tr, float randomOffsetMin, float randomOffsetMax, float animationTime, Vector3 from, Vector3 to)
    {
        float elapsedTime = 0;

        while (elapsedTime < animationTime)
        {
            float t = PennerAnimation.QuadEaseInOut(elapsedTime, 0, 1, animationTime);
            tr.position  = Vector3.Lerp(from, to, t);
            elapsedTime += Time.deltaTime;
            yield return(0);
        }

        tr.position = to;
    }
Esempio n. 4
0
    void HoverOnZ(float t, Vector3 pivotLocation)
    {
        float sz = PennerAnimation.QuadEaseInOut(t, pivotLocation.z, changeInValue, 1);

        transform.localPosition = new Vector3(pivotLocation.x, pivotLocation.z, sz);
    }
Esempio n. 5
0
    void Sway(float t, Vector3 pivotLocation)
    {
        float sx = PennerAnimation.QuadEaseInOut(t, pivotLocation.x, changeInValue, 1);

        transform.localPosition = new Vector3(sx, pivotLocation.y, pivotLocation.z);
    }