Switching default animation on key press

Hello, super noob here any advice would be most grateful as I dont really know what im doing very well. Anyway my problem is, I am trying to make a simple script to switch weapons. Now in this script when we switch weapons it switches to a diffrent default animation. We are using 2d side scrolling method, however our artist has made sprite sheet idle animations for every weapon and is insistent on using them. hit key, switches weapon, and goes to default idle for that weapon.

Part of me thinks im trying to go about this all wrong, any advice would be helpful.

Here is a basic code I cannot get to work. and my compiler errors.

using UnityEngine;
using System.Collections;

public class sweapon : MonoBehaviour {

	Animator anim;

void Start()
{ 	anim = GetComponent<Animator>(); 

void Update () 	

     Animation["_zak-idle-wth-axe.anim"].time = 1.0; 		}


This seems so simple to play an animation what is my problem?

Compile errors:

-Assets/sweapon.cs(25,35): error CS0120: An object reference is required to access non-static member `UnityEngine.Animation.Play()’

-Assets/sweapon.cs(26,25): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected

Please help im pulling my hair out here trying to understand scripting from no background of programming whatsoever.

bcoz animation is a non static class …u need its object to access its methods and variables…
try anim.animation.play(“_zak-idle-wth-axe.anim”);

Define your Animator variable as Public,then drag ur objectwith it’s animator over your animator parameter in the inspector.

Example Csharp script:

using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
	int state = 0;
	public Animator animator1;
	void Start () {
	// Update is called once per frame
	void Update () {
		if (Input.GetKey (KeyCode.LeftArrow)) {
			state = 1;
		if (Input.GetKey (KeyCode.RightArrow)){
			state = 2;
		if (animator1 == null) {
			Debug.LogError("Animator is null!");
		} else {
			 animator1.SetInteger("state", state);