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

public class levelChooser : MonoBehaviour
{
    private static int index = 0;
    public static string[] scenes = {"Level 1", "Level 2", "Level 3", "Level 4", "Level 5", "Level 6", "Level 7" };

    void Move(int change)
    {
        index = Mathf.Clamp(index + change, 0, scenes.Length - 1);
    }

    public void AddOne()
    {
        Move(+1);
    }

    public void RemoveOne()
    {
        Move(-1);
    }

    public static void ChooseLevel(int level)
    {
        index = Mathf.Clamp(level-1, 0, scenes.Length - 1); ;
        Debug.Log(index);
        SceneManager.LoadScene(sceneName: scenes[index]);
    }

    public static void NextLevel()
    {
        index += 1;
        if (index < scenes.Length)
            SceneManager.LoadScene(sceneName: scenes[index]);
        else
        {
            index = 0;
            SceneManager.LoadScene(sceneName: "Menu");
        }
    }
}
