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

public class DoorScript : MonoBehaviour {

    Animator anim;

    public enum DoorType
    {
        door, beam
    };
    public DoorType doorType;
    public GameObject beam;
    private BoxCollider2D col;
    private void Start()
    {
        anim = GetComponent<Animator>();
        col = GetComponent<BoxCollider2D>();
    }

    public void OpenDoor()
    {

        if ((int)doorType == 0)
        {
            
            anim.SetBool("IsOpening", true);
        }
        else
        {
            beam.SetActive(false);
            col.enabled = false;
        }
        GetComponent<AudioSource>().Play();
    }
    public void StayOpen()
    {
        anim.SetBool("Open", true);
        anim.SetBool("IsOpening", false);
        
        GetComponent<BoxCollider2D>().enabled = false;
    }
}
