var moveComponent;
moveComponent= GetComponent(PlayerControllerMove);

var runSpeed;
runSpeed = moveComponent.runSpeed;

function Start()
{



//set all animations to loop
animation.wrapMode = WrapMode.Loop;

animation["jumpDown"].wrapMode = WrapMode.ClampForever;
animation["jumpUp"].wrapMode = WrapMode.ClampForever;

animation.Stop(); 
}


function Update ()
{
  
// The current x-z move speed (referenced from Player Controller Move script)
var moveSpeed;
moveSpeed = moveComponent.moveSpeed;
  
//Debug.Log(moveSpeed);


if (moveComponent.IsGrounded())
{


if( moveSpeed > .1 )
   {
		if( moveSpeed >= (runSpeed -3) )
			animation.CrossFade("run");
		else
			animation.CrossFade("walk");
	}
	else
   {
	animation.CrossFade("idle");
	} 
} //ends if statement IsGrounded
else
{


if (moveComponent.IsJumping () )
{

	if (moveComponent.HasJumpReachedApex ())
		animation.CrossFade("jumpDown");
	else
		animation.CrossFade("jumpUp");
}

}

} //ends function update


		

	

@script RequireComponent(CharacterController)