How to swap among various animations?

I build a fighting game. There are Player and NPC.

When Player moves close to NPC, NPC starts to fight.

There are 3 fight animations:
punch
kick
special

Here is the code:

var incre : int = 0;
var ran : int[];
ran = new int[3]; 

function Update () 
{	    
    var heading = targetTransform.position - transform.position; 
    if(heading.x > -2  heading.x < 2)
    {    	   	
    		if(ran[incre] == 0)
    		{    		   
                    Punch();  
                    incre += 1;	           
    		}
    		if(ran[incre] == 1)
    		{
                    Kick();
                    incre += 1;	
    		}
    		if(ran[incre] == 2)
    		{
                   Special();
                   incre += 1;	             
    		}    	    		
    		
    		if(incre == 2)
    	        {
    		   incre = 0;
   		}
    }
}

However, it always plays Punch() only.

I think the logic for

if(incre == 2)
{
   incre = 0;
}

is wrong.

As each time of update, incre resets to 0.

How should I change the logic?

to play punch, kick and special sequence?

Unless there is other code that you haven’t posted then the elements of the ran array will all be initialised to zero. Therefore “ran[incre]” will always return zero and select the punch animation. If you are setting the values of ran from the inspector, you should miss out this line:-

ran = new int[3];