using UnityEngine;

public class DoubleLeverValidator : MonoBehaviour
{
    [SerializeField] LeverInteractables[] leversArray;
    [SerializeField] GameObject door;
    [SerializeField] GameObject minotaur;
    [SerializeField] Transform minotaurSpawnPos;

    private void Start()
    {
        for (int i = 0; i < leversArray.Length; i++)
        {
            leversArray[i].onLeverActivate += LeverValidation;
        }
    }

    void LeverValidation(bool isValidated)
    {
        for (int i = 0; i < leversArray.Length; i++)
        {
            if (!leversArray[i].IsActive)
            {
                return;
            }
        }
        OpeningDoor();
    }

    void OpeningDoor()
    {
        door.transform.position += new Vector3(0f, 50f, 0f);
        GameObject temp = Instantiate(minotaur);
        temp.transform.position = minotaurSpawnPos.position;
    }
}
