Assist with CollisionDetection

Hello everybody! Could you please help with making the SendMessage function (BTW Is it right to call it a function?) work once per animation even if there were numerous collisions. Or how can I make the collisions to be undetectable for a certain amount of time?

Sorry if there are mistakes, English is a foreign language to me.

#pragma strict

var otherObj : GameObject;
var Damage : int = 50;

function OnCollisionEnter (hit : Collision)
{
	if(otherObj.animation["Attack"].enabled)
	{
		if(hit.gameObject.tag == "enemy")
		{
			hit.gameObject.SendMessage("ApplyDamage", Damage);
		}	
	}
}

You can check if the animation is playing using

if (!animation.IsPlaying("Attack"))
{
...
}

Just ignore the collisions while Attack is playing.

It should work with enabled also, but in both cases you should use a var to check if you sent the message. Something like:

var otherObj : GameObject;
var Damage : int = 50;
var hasSentAttackMessage: bool = false;
 
function OnCollisionEnter (hit : Collision)
{
    if(otherObj.animation["Attack"].enabled && !hasSentAttackMessage)
    {
        if(hit.gameObject.tag == "enemy")
        {
            hit.gameObject.SendMessage("ApplyDamage", Damage);
            hasSentAttackMessage = true;
        }   
    }
    else if(!otherObj.animation["Attack"].enabled)
    {
        hasSentAttackMessage = false;
    }
}