Exemplo n.º 1
0
    private void Update()
    {
        if (startSplash)
        {
            startSplash = false;

            StartSplash();
        }

        switch (splashStage)
        {
        case SplashStage.Idle:

            break;

        case SplashStage.IsWaiting:
            time += Time.deltaTime;

            if (time >= delay)
            {
                splashStage = SplashStage.IsStarting;
                time        = 0;
            }
            break;

        case SplashStage.IsStarting:
            color.a += fadeIn * Time.deltaTime;

            if (color.a >= 1f)
            {
                color.a = 1f;

                splashStage = SplashStage.IsShowing;
            }

            material.color = color;
            break;

        case SplashStage.IsShowing:
            time += Time.deltaTime;

            if (time >= duration)
            {
                splashStage = SplashStage.IsEnding;
            }
            break;

        case SplashStage.IsEnding:
            color.a -= fadeOut * Time.deltaTime;

            if (color.a <= 0)
            {
                color.a = 0f;

                splashStage = SplashStage.HasEnded;
            }

            material.color = color;
            break;

        case SplashStage.HasEnded:
            if (nextScreen != null)
            {
                nextScreen.StartSplash();
            }

            splashStage = SplashStage.Idle;
            break;
        }
    }
Exemplo n.º 2
0
 public void StartSplash()
 {
     splashStage = SplashStage.IsWaiting;
 }