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

public class LoadLevel : MonoBehaviour {

    public void LoadNextLevel()
    {
        var next = SceneManager.GetActiveScene().buildIndex + 1;
        if(next == SceneManager.sceneCountInBuildSettings)
            SceneManager.LoadScene(0);
        else
            SceneManager.LoadScene(next);
    }

    public void ReloadLevel()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }

    public void ResartGame()
    {
        SceneManager.LoadScene(0);
    }

    void Update()
    {
        if (Input.GetKey("escape"))
        {
            ReloadLevel();
        }
    }

    public void ExitGame()
    {
        Application.Quit();
    }
}
