How can I create a pressure pad in order to open a door?

I’m making a 2D platformer with Unity. I want to create a pressure pad in order to open a door and I want the door to open when the player is on the pressure pad and close in few seconds after the player leaves the pressure pad. I’ve tried different ways but none of them worked. In this case, the door should be open upwards and close downwards. Also, I already created some animations (idle, open and close) for the door but don’t know how to make a connection between these two objects then play the animations at the proper time. Thank you in advance.

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events;  public class PressureSwitch : MonoBehaviour {     public UnityEvent OnActivate;     public UnityEvent OnDeactivate;      int _objectsInContact;      void OnTriggerEnter(Collider other)     {         _objectsInContact++;         if (_objectsInContact == 1 && OnActivate != null) OnActivate.Invoke();     }      void OnTriggerExit(Collider other)     {         _objectsInContact--;         if (_objectsInContact == 0 && OnDeactivate != null) OnDeactivate.Invoke();     } } 

enter image description here