Hi all
I will could do three attacks.
like risen.
when player click play animation of attack 1 then if player click play animation of attack 2 then if player click play animation of attack 3 then if player click do not play animation till last animation end.
any one has any idea?
Thankful.
anyone hasnt any idea?
You mean a Combo attack, right?
Like in the old fight games where hitting the Attack buttons several times in a row would result in different animations.
I think you would have something like this:
private var Combo:int = 0; //This keeps track of the current combo level
private var TimeSinceLastAttack:float = 0; //Used to check how much time passed since we attacked. If it takes too long for us to attack, then the combo will not register.
function Update()
{
TimeSinceLastAttack += Time.deltaTime; //Add the frame time to the value of TimeSinceLastAttack
if ( Input.GetKey("mouse 0") ) //If you tap (click once) the Left Mouse Button, do the following...
{
if ( TimeSinceLastAttack < 1 ) //If less than a second passed since the last attack, keep the combo going
{
TimeSinceLastAttack = 0; //Reset the timer
Combo++; //Increase the combo value
}
else
{
TimeSinceLastAttack = 0; //Reset the timer
Combo = 1; //reset the combo to 1, the first attack
}
}
//Now we check the value of combo and run the correct animation
if ( Combo == 1 )
{
animation.CrossFade("Attack01", 0.2);
}
else if ( Combo == 2 )
{
animation.CrossFade("Attack02", 0.2);
}
else if ( Combo == 3 )
{
animation.CrossFade("Attack03", 0.2);
}
}
very thankful for your help