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

public class StartFade : MonoBehaviour
{

    public float timeToFade;
    public string scene;

    private float _timeFading;
    private bool _fading = true;

    // Use this for initialization
    void Start()
    {
        GetComponent<Animator>().SetBool("Fade", true);
        _fading = true;
    }

    // Update is called once per frame
    void Update()
    {

        if (_fading)
        {
            _timeFading += Time.deltaTime;

            if (_timeFading >= timeToFade)
            {
                
                SceneManager.LoadScene(scene);
            }
        }
    }
}