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

public class DoorController : MonoBehaviour
{
    // Start is called before the first frame update
    public Collider2D bluePlayerCollider;
    public Collider2D orangePlayerCollider;
    public Animator doorAnimator;

    public Animator buttonBlue;
    public Animator buttonOrange;

    private Collider2D doorCollider;

    private void Awake()
    {
        doorCollider = GetComponent<BoxCollider2D>();
    }

    private void Update()
    {
        if (buttonBlue.GetBool("ButtonPressed") && buttonOrange.GetBool("ButtonPressed"))
            doorAnimator.SetBool("DoorOpen", true);
        if (doorAnimator.GetBool("DoorOpen") && doorCollider.IsTouching(bluePlayerCollider) && doorCollider.IsTouching(orangePlayerCollider))
            levelChooser.NextLevel();
    }
}
