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

public class DisableDoor : MonoBehaviour
{
    [SerializeField]
    private GameObject doorHandle;

    [SerializeField] private GameEvent openedDoorEvent;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    void OnTriggerEnter(Collider c)
    {
        if (c.gameObject == doorHandle)
        {
            c.gameObject.layer = LayerMask.NameToLayer("FinishedPuzzles");
            c.gameObject.GetComponentInParent<Rigidbody>().velocity = Vector3.zero;
            c.gameObject.GetComponentInParent<Rigidbody>().isKinematic = true;
            openedDoorEvent.Raise();
        }
    }
}
