Recoil Animation

Hi I am working on a recoil animation (I have already completed the animation) and I want to put it where every time I shoot the gun has recoil here is my shoot script I want to know how to put the animation in the script without screwing up the script.

#pragma strict

var Effect : Transform;
var TheDammage = 100;

function Update () {

var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));

if (Input.GetMouseButtonDown(0))
  
{
	if (Physics.Raycast (ray, hit, 100))
	  
	{

		var particleClone = Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal));
		Destroy(particleClone.gameObject, 2);
		hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
	}
}

}

Well, since you already define the Ray at the start of the Update() function, it doesn’t rally matter where exactly you make the recoil animation play. I suggest just putting it after the hit message.

Animations are played with Animation.Play(animationNmame) or Animation.Crossfade(animationName, fadeTime in seconds). Your gun and/or character objects needs to have an Animation component with the recoil animation, of course.