using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class ScreenFader : MonoBehaviour 
{
    private CanvasGroup TransitionScreen;
    
    public bool CanTransition;
    public float rate;

    public enum TransitionType
    {
        FadeIn,FadeOut
    }

    public IEnumerator FadeIn()
    {
        while (TransitionScreen.alpha <1)
        {
            TransitionScreen.alpha += rate;
            yield return null;
        }
    }

    public IEnumerator FadeOut()
    {
        while (TransitionScreen.alpha > 0)
        {
            TransitionScreen.alpha -= rate;
            yield return null;
        }
    }

    public IEnumerator FadeInandOut()
    {
        yield return FadeIn();
    }


    

}
