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

public class ActionLines : MonoBehaviour
{
    public Color correctColor, errorColor;
    public Image[] actionLines;

    public void ShowLines(bool correct)
    {
        for (int i = 0; i < actionLines.Length; i++)
        {
            actionLines[i].color = (correct) ? correctColor : errorColor;
        }

        StartCoroutine(WaitToHide());
    }

    private IEnumerator WaitToHide()
    {
        for (int i = 0; i < actionLines.Length; i++)
        {
            actionLines[i].gameObject.SetActive(true);
        }

        yield return new WaitForSeconds(0.5f);

        for (int i = 0; i < actionLines.Length; i++)
        {
            actionLines[i].gameObject.SetActive(false);
        }
    }

    public void Hide()
    {
        for (int i = 0; i < actionLines.Length; i++)
        {
            actionLines[i].gameObject.SetActive(false);
        }
    }
}
