using Managers;
using UnityEngine;

public class HandleLevelCompletion : MonoBehaviour
{
    [SerializeField] int currentLevel = 1;
    public static HandleLevelCompletion Instance { get; private set; }

    void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
            return;
        }
        Instance = this;
    }

    void OnDestroy()
    {
        if (Instance == this)
            Instance = null;
    }

    public void LevelWon()
    {
        if (GlobalData.lastCompletedLevel < currentLevel)
            GlobalData.lastCompletedLevel = currentLevel;
    }
}
