Stop Movement while attacking

I need to be able to stop my character from moving when ever it plays an attack animation. Can anyone offer a solution.

function Attack(){
//Play the animation, set attacking true for 1 second and then back to false
    attacking = true;
    yield WaitForSeconds(1);
    attacking = false;

if the movement code is in the same script, just nest it into an

if(!attacking){//your movement code here }

otherwise set the attacking as

static var attacking: boolean;

then the previoslu mentioned if would be

if(!scriptname.attacking){//your movement code here }

you can see an example of this on the First Person Shooter example of unity on the Walker script they use a isGrounded var to check if the character is on the ground before jumping.

Hello i know its a old post but i find more usefull use a FSM to movement logic, this avoid a bunch of if else statements.