I have an animation that plays when i attack but the problem is if i press any other button midway through attacking the animations stops and it looks bad. can anyone help? my script:
#pragma strict
var swording = false;
function Update () {
if (!swording && Input.GetButtonDown("Fire1")) {
DoSword();
}
if (Input.GetKeyDown(KeyCode.W)) {
animation.Play("Walking") ;
}
if (Input.GetKeyUp(KeyCode.W)) {
animation.Play("Idle") ;
}
if (Input.GetKeyDown(KeyCode.Space)) {
animation.Play("Jumping", PlayMode.StopAll) ;
}
}
function DoSword() {
swording = true;
animation.Play("attack", PlayMode.StopAll) ;
yield WaitForSeconds (0.68) ;
animation.Play("Idle", PlayMode.StopAll) ;
swording = false;
}
its a bit weird because i got someone to help me with it but it turned out the code they added didnt really need to be there so theres a chunk of useless code.