how can i make this code that when i press T its switches the animation to run and when i press T again it changes back the animation to walk this is what i got now and if you can help me that will be great if your confused just comment
animation.wrapMode = WrapMode.Loop;
animation["jump"].wrapMode = WrapMode.Clamp;
animation["shoot"].wrapMode = WrapMode.Clamp;
animation["grab"].wrapMode = WrapMode.Clamp;
animation["idle"].layer = -1;
animation["walk"].layer = -1;
animation["run"].layer = -1;
animation.Stop();
function Update () {
if (Mathf.Abs(Input.GetAxis("Vertical")) > 0.1)
animation.CrossFade("walk");
else
animation.CrossFade("idle");
if(Input.GetKeyDown("t"))
animation.CrossFade("run");
if (Input.GetButtonDown ("Jump"))
animation.CrossFade("jump");
if (Input.GetButtonDown ("grab"))
animation.CrossFadeQueued("grab", 0.08, QueueMode.PlayNow);
if (Input.GetButtonDown ("Fire1"))
animation.CrossFadeQueued("shoot", 0.3, QueueMode.PlayNow);
}