For anyone that’s interested I finally got my attack combo script finished, here it is.
var LastPress : float;
var timer : float;
var Ctime : float = 1;
var tap : int;
var attack : boolean = true;
var Atime : float = 2;
var Aspeed : float = 2;
function Update(){
timer = Time.timeSinceLevelLoad;
if(Input.GetKeyDown("j")){
LastPress = Time.timeSinceLevelLoad;
if(tap > 2){
tap = 1;
}
else{
tap++;
}
Combo();
}
if(timer - LastPress > 1){
tap = 0;
if(timer - LastPress < Atime){
attack = false;
}
else{
attack = true;
}
}
}
function Combo () {
//WaitForSeconds(2);
if(attack){
switch (tap){
case 0:
//Reset to Idle
break;
case 1:
//Combo Start
Atime = animation["Attack1"].length;
animation.PlayQueued("Attack1", QueueMode.PlayNow);
break;
case 2:
//Combo Prolonged
Atime += animation["Attack2"].length;
animation.PlayQueued("Attack2", QueueMode.CompleteOthers);
break;
case 3:
//Combo Finished
Atime += animation["Attack3"].length;
animation.PlayQueued("Attack3", QueueMode.CompleteOthers);
break;
}
}
}