Example #1
0
    IEnumerator FadeStart()
    {
        yield return(new WaitForSeconds(fadeStartsIn));

        if (!startedFade)
        {
            startedFade = true;
            ScreenFade.FadeFrom(new Color(0, 0, 0, 0));
            ScreenFade.FadeTo(new Color(0, 0, 0, 1.0f), 1.0f);
        }
    }
Example #2
0
    void Update()
    {
        // Switch to the fade straight away if the user presses a button
        if (!startedFade && Input.GetMouseButton(0))
        {
            startedFade = true;
            ScreenFade.FadeFrom(new Color(0, 0, 0, 0));
            ScreenFade.FadeTo(new Color(0, 0, 0, 1.0f), 1.0f);
        }

        if (ScreenFade.IsDoneFading())
        {
            ScreenFade.ResetDoneFading();
            StartCoroutine("LevelChange");
        }
    }