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

public class UIState : MonoBehaviour
{
    private UIManager UI;

    [Header("Configuration")]
    public bool initialValue;
    [Space]
    public Color onColor;
    public string onText;
    public Color offColor;
    public string offText;
    
    [Header("Object References")]
    public Image onOffColorImage;
    public Text displayText;

    private void Awake()
    {
        UI = GameObject.FindWithTag("UIManager").GetComponent<UIManager>();
    }

    void Start()
    {
        
        Set(initialValue);
    }

    public void Set(bool value)
    {
        onOffColorImage.color = value ? onColor : offColor;
        displayText.text = value ? onText : offText;
        
        UI.Redraw(transform);
    }   
}
