using UnityEngine;
using System.Collections;


namespace UnityStandardAssets._2D
{
	
	public class Fader : MonoBehaviour {
		private Animator m_anim;
		bool haciendoFade;
		// Use this for initialization
		void Start () {
			m_anim = GetComponent<Animator> ();
		
		}
		
		// Update is called once per frame
		void Update () {
		
		}

		public IEnumerator fadeToClear(){
			Debug.Log ("clear");
			haciendoFade = true;
			m_anim.SetTrigger ("fadeIn");
			while (haciendoFade)
				yield return null;
			
		}
		public IEnumerator fadeToBlack(){
			Debug.Log ("black");
			haciendoFade = true;
			m_anim.SetTrigger ("fadeOut");
			while (haciendoFade) 
				yield return null;
			
		}

		public void completa(){
			Debug.Log ("completo");
			haciendoFade = false;
		}
	}
}
