var lPunch : boolean = false;
var rPunch: boolean = false;
var lKick : boolean = false;
var rKick: boolean = false;
var inAnim : boolean = false;
var ready : boolean = true;
function Awake(){
var p1Lshoulder = gameObject.FindWithTag("P1LShoulder").transform;
gameObject.animation["LeftJab"].AddMixingTransform(p1Lshoulder);
animation["LeftJab"].layer = 1;
var p1Rshoulder = gameObject.FindWithTag("P1RShoulder").transform;
animation["RightJab"].AddMixingTransform(p1Rshoulder);
animation["RightJab"].layer = 1;
var p1Lthigh = gameObject.FindWithTag("P1LThigh").transform;
animation["LeftKick"].AddMixingTransform(p1Lthigh);
animation["LeftKick"].layer = 1;
var p1Rthigh = gameObject.FindWithTag("P1RThigh").transform;
animation["RightKick"].AddMixingTransform(p1Rthigh);
animation["RightKick"].layer = 1;
animation.CrossFade("idle");
}
function Update () {
//LeftPunch-
if(Input.GetButtonDown("Button1")){
if(ready){
lPunch=true;
ready = false;
animation.CrossFadeQueued("LeftJab",.1F,QueueMode.CompleteOthers);
//animation.Play("LeftJab");
}
}else if(Input.GetButtonUp("Button1")){
ready = true;
}
if(lPunch &&!animation.IsPlaying("LeftJab")){
animation.CrossFadeQueued("idle",0.01F,QueueMode.CompleteOthers);
lPunch = false;
}
//RightPunch-
if(Input.GetButtonDown("Button2")){
if(ready){
rPunch = true;
ready = false;
animation.CrossFadeQueued("RightJab",.09F,QueueMode.CompleteOthers);
}
}else if(Input.GetButtonUp("Button2")){
ready =true;
}
if(rPunch &&!animation.IsPlaying("RightJab")){
animation.CrossFadeQueued("idle",0.5F,QueueMode.CompleteOthers);
rPunch = false;
}
//LeftKick-
if(Input.GetButtonDown("Button3")){
if(ready){
rKick = true;
ready = false;
animation.CrossFadeQueued("LeftKick",.01F,QueueMode.CompleteOthers);
}
}else if(Input.GetButtonUp("Button3")){
ready =true;
}
if(lKick &&!animation.IsPlaying("LeftKick")){
animation.CrossFadeQueued("idle",1F,QueueMode.CompleteOthers);
lKick = false;
}
//RightKick-
if(Input.GetButtonDown("Button4")){
if(ready){
lKick = true;
ready = false;
animation.CrossFadeQueued("RightKick",0.2F,QueueMode.CompleteOthers);
}
}else if(Input.GetButtonUp("Button4")){
ready =true;
}
if(rKick &&!animation.IsPlaying("RightKick")){
animation.CrossFadeQueued("idle",0.01F,QueueMode.CompleteOthers);
rKick = false;
}
}