Exemplo n.º 1
0
    public IEnumerator Play()
    {
        TransitionManager transitionManager = TransitionManager.Instance;

        // Set color
        transitionManager.Material.color = color;

        // Load level
        transitionManager.LoadLevelAsync();

        // Fade out
        yield return(transitionManager.TickMaterialProgress(duration));

        //
        transitionManager.Material.mainTexture = TextureHelper.GetTransparentPixel();

        if (!transitionManager.IsLevelLoaded())
        {
            // Wait for level loaded
            yield return(transitionManager.WaitForLevelToLoad());
        }

        // Fade in
        yield return(transitionManager.TickMaterialProgress(duration, true));
    }