About Shooting With Gun

Hi.I made An animation for my gun called “shootwithm9”
i have a bullet called “Bullet”
and i wrote a script for shooting
and im getting errors
this is my script:

using UnityEngine;
using System.Collections;

public class M9 : MonoBehaviour {

	public Transform M9bullet;
	public Transform BulletSpawn;

	public int OurAmmo = 100;

	private RaycastHit hit;
	private Vector3 dir;
	private Quaternion rot;

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
		if (animation.isplaying("shootwithm9") == false) {
			if (Input.GetButtonDown ("Fire1")) {
				if (OurAmmo > 0) {
					Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f,0.5f,0));

					if (Physics.Raycast(Ray, out hit)) {
						dir = (hit.point - BulletSpawn.position).normalized;
					}
					else {
						dir = ray.direction;
					}
					rot = Quaternion.FromToRotation (-M9bullet.transform.forward, dir);
					Instantiate(M9bullet, BulletSpawn.position, rot);
					Animation.Play ("shootwithm9");
					audio.Play();
					OurAmmo -= 1;
				}
			}
		}
		//CheckAmmo
	}
}

Check The Script.
Thank you
and sorry for bad english

Ok i looked at the code and came up with this

using UnityEngine;
using System.Collections;

//just to make sure the animation component is on the object
[RequireComponent(Animation)]

public class M9 : MonoBehaviour {

	public Transform M9bullet;
	public Transform BulletSpawn;

	public int OurAmmo = 100;

	private RaycastHit hit;
	private Vector3 dir;
	private Quaternion rot;

	//problems found that i found ##############################################################33
	Animation yourAnimation;
	AudioSource yourAudio;

	// Use this for initialization
	void Start () {
		yourAnimation = GetComponent<Animation> ();
	}

	// Update is called once per frame
	void Update () {
		if (yourAnimation.IsPlaying("shootwithm9") == false) {
			if (Input.GetButtonDown ("Fire1")) {
				if (OurAmmo > 0) {
					Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f,0.5f,0));

					if (Physics.Raycast(Ray, out hit)) {
						dir = (hit.point - BulletSpawn.position).normalized;
					}
					else {
						dir = ray.direction;
					}
					rot = Quaternion.FromToRotation (-M9bullet.transform.forward, dir);
					Instantiate(M9bullet, BulletSpawn.position, rot);
					yourAnimation.Play ("shootwithm9");
					yourAudio.Play();
					OurAmmo -= 1;
				}
			}
		}
		//CheckAmmo
	}
}

I think it should work, and if i doesn’t then post the new errors and i will take another look.

Thank You It Worked