using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class ScreenTransitionController : MonoBehaviour {

    public GameObject transitionAnim;

	// Use this for initialization
	public void goToCredits () {
        StartCoroutine(waitAndLoadScene("credits"));
	}

    public void goToLevelMenu() {
        StartCoroutine(waitAndLoadScene("level_menu"));
    }

    IEnumerator waitAndLoadScene(string nextScene) {
        transitionAnim.SetActive(true);
        yield return new WaitForSeconds(0.5f);
        SceneManager.LoadScene(nextScene);
    }
}
