Prb with Animation

Hi guys,
I’m having some trouble with my attack animation script and I was hoping someone could take a look at it and help. I’m simply trying to get a monster to attack me while within a certain range and play his attack animation…(which he does correctly), however I can’t get him to return to his default walk animation when not attacking (player out of range). Any help would be greatly appreciated. Please go easy on me, as I’m still quit new to coding. Thanks all.

/// EnemyAttack.cs
using UnityEngine;
using System.Collections;

public class EnemyAttack : MonoBehaviour {
	public GameObject target;
	public float attackTimer;
	public float coolDown;
	public bool isAttacking;

	// Use this for initialization
	void Start () {
		attackTimer = 0;
		coolDown = 2.0f;
	}
	
	// Update is called once per frame
	void Update () {
		if(attackTimer > 0)
			attackTimer -= Time.deltaTime;
		
		if(attackTimer < 0)
			attackTimer = 0;
		
		if(attackTimer == 0) {
			Attack();
			attackTimer = coolDown;
			
		if(isAttacking)
        	animation.CrossFade("2LegsClawsAttackR");
    		else
				if(!isAttacking)
        			animation.CrossFade("2LegsWalk");
		}
	}
	
	private void Attack() {
		float distance = Vector3.Distance(target.transform.position, transform.position);
		
		Vector3 dir = (target.transform.position - transform.position).normalized;
		
		float direction = Vector3.Dot(dir, transform.forward);
		
		if(distance < 2.5f) {
			if(direction > 0) {
				PlayerHealth eh = (PlayerHealth)target.GetComponent("PlayerHealth");
				eh.AddjustCurrentHealth(-10);
				isAttacking = true;
				}
		
		}
	}
}

You never make isAttacking to be false:
//attack
if(distance < 2.5f){
blah
}
else isAttacking = false;

Okay, I’ll try that. Thank you.
Was I wrong in thinking that the “!” would assign it to false by default?

Line 32:

else

if(!isAttacking)

animation.CrossFade(“2LegsWalk”);

! can assign, if you use it in this manner:

isAttacking = !isAttacking;

or

isAttacking = !true; (this of course might as well be false)

Thank you for the help guys, ive tried the suggestions and several other things that i can think of, however i must still be missing something obvious. Ive worked on this prb for the last 4hrs with no luck, and needed to walk away before i go crazy. I simply cant figure why when the player runs out of range that the animation will not return to the one it was playing before the Attack() method was called. If anyone has any other ideas I’d sure love to hear em, and again I thank you.

Just wanted to give an update guys, that I’ve finally fixed the prb. Thanks for the help.