Need help with some OnTrigger Scripting

I am currently working on a maze type game, and I have run into a problem that requires some scripting that I don’t know how to do. My idea is that once the player has collided with the collider, a separate game object’s animation is played in which it comes down and blocks the exit of the maze. I’ve done some OnTrigger scripting for stuff like teleporters before, but this one has got me confused.

what if you try something like this:

make two separate scripts-

//attach this on the player gameObject

function OnCollisionEnter ( collision : Collision ){

	collision.gameObject.SendMessage("PlayAnimation", SendMessageOptions.DontRequireReceiver);

}

and make another for the object in the maze

//attach this to a maze object

function PlayAnimation()
    {
    	gameObject.animation.Play("ClosingDoorAnimation");
    }

you can have the PlayAnimation() function on all of your maze object and just change the animation name inside that function.

i hope this helps…

If you are looking for something similar to a trap trigger:

public class RemoteTrapTrigger : MonoBehaviour {
   public GameObject trap;

   void OnTriggerEnter( Collider other ) {
      if( other.gameObject.CompareTag("Player") ) {
         trap.animation.Play("Activate");
      }
   }
}

Attach this script to the trigger, assign the door/trap as the trap.