using TMPro;
using UnityEngine;

public class EmptyRoom : Room
{
    [SerializeField] private GameObject numberTextObject;

    protected override void InitializeRoom() {
        base.InitializeRoom();
        TextMeshProUGUI numberText = numberTextObject.GetComponent<TextMeshProUGUI>();
        if (_locks[0] is NumberLock )
        {
            numberText.SetText(((NumberLock)_locks[0]).GetNumber().ToString());
        }
        else if (_locks[0] is MatchingDiceLock)
        {
            numberText.SetText("=");
        }
    }

    public override bool TryUnlock(DicePair pair)
    {
        return _locks[0].CheckIfKeyFits(pair);
    }

    public override void SetRoomExplored() {
        _isExplored = true;
        UnhighlightRoomAsOption();
        if (roomReward != null)
        {
            roomReward.TriggerGetReward();
        }
        gameObject.GetComponent<SpriteRenderer>().color =
            ColorHelper.AddColorTint(gameObject.GetComponent<SpriteRenderer>().color, Color.grey, 0.5f);
    }
}
