using UnityEngine;

public class DoorTrigger : MonoBehaviour 
{
    void OnCollisionEnter2D(Collision2D c)
    {
        Debug.Log("Door triggered by " + c.transform.name);
        Human h = c.transform.GetComponent<Human>();
        if (h != null)
            OpenDoor();
    }

    private void OpenDoor()
    {
        ScrambleKit.FX.SoundFX.PlaySound("OpenDoor");
        Debug.Log("Door opening");
        Destroy(gameObject, 0.1f);
    }
}
