using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class OnEnableLevelSelectorPanel : MonoBehaviour
{
    Button[] Buttons;

    private void Awake()
    {
        Buttons = GetComponentsInChildren<Button>();
    }

    private void OnEnable()
    {
        for(int i = 0; i < Buttons.Length - 1; i++)
        {
            if(i <= PlayerPrefs.GetInt("LastLevelUnlocked", 1))
            {
                Buttons[i].interactable = true;
            }
            else
            {
                Buttons[i].interactable = false;
            }
        }
    }
}
