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

public class LvlManager : MonoBehaviour
{
    public Player player;
    public string name;

    public Animator anim;
    private bool started;
	// Use this for initialization
	void Start ()
    {
        started = false;
	}
	
	// Update is called once per frame
	void Update ()
    {
        if(Input.GetButtonUp("Jump") && !started)
        {
            anim.Play("intro_play");
            started = true;
        }

        if (player.state == State.DEAD)
            StartCoroutine(PlayerDead());
	}

    IEnumerator PlayerDead()
    {
        yield return new WaitForSeconds(1.5f);
        GameManager.LoadScene(name);
    }
}
