How can I make my character not walk while he performs the attack animation?

I’ve marked an “if” with " ** " to locate the problem.

public float speed = 2.0f;
public float rotationSpeed = 75.0f;

    float translation = Input.GetAxis("Vertical") * speed;
    float rotation = Input.GetAxis("Horizontal") * rotationSpeed;
    translation *= Time.deltaTime;
    rotation *= Time.deltaTime;
    transform.Translate(0, 0, translation); 
    transform.Rotate(0, rotation, 0);
    **if ((Input.GetMouseButtonDown(0)) && (translation == 0)) //Attack**
    {
            anim.Play("Attack");
    }
    // Transition Walk / Run
    if ((translation != 0) && (speed == 8))//Run animation
        {
        anim.SetBool("Walk", false);
        anim.SetBool("Run", true);
        } else
        if ((translation != 0) && (speed == 4))//Walk animation
        {
            anim.SetBool("Run", false);
            anim.SetBool("Walk", true);
        } else //stay still(Idle) animation
        {
            anim.SetBool("Run", false);
            anim.SetBool("Walk", false);
            anim.SetBool("Idle", true);
        }
    // End of transition Walk / Run

download this and check it in new project… look for player controller and animation controller. This playercontrols script is very good sample for what you need.

 if(!walk||!run)
{ 
if ((Input.GetMouseButtonDown(0)) && (translation == 0)) //Attack**

{
  anim.play("Attack")
}
}