Hi. Im coding my character´s movement so if it getmousebutton (1), he will do an animation, and after X secs(animation length), it will be false… (melee ones)
So worked fine until now.
Now im trying to change weapons, and i dont want to change the weapon if the animation melee1 is playing so…
I thought about this:
if (Input.GetMouseButton (1) && m == 1) {
canSwing = true;
animador.SetBool ("Aim", true);
//v & h movement on x and y axis.
if (v > 0.1) {
animador.SetBool ("Aim", false);
animador.SetBool ("Walk", true);
}
if (v < 0) {
animador.SetBool ("Aim", false);
animador.SetBool ("Atras", true);
}
if (h < -0.1) {
animador.SetBool ("Aim", false);
animador.SetBool ("WalkLeft", true);
}
if (h > 0.1) {
animador.SetBool ("Aim", false);
animador.SetBool ("Walkright", true);
}
StartCoroutine(WaitSec(0.83F));
animador.SetBool ("Aim",false);
canSwing=false;
}
With a simple IEnumerator:
IEnumerator WaitSec(float waitime)
{
yield return new WaitForSeconds(waitime);
}
And it seems that its not working… I mean the conditional isnt doint anything. It seems that animation will have true and instanly false value. Thats not the purpose of the StartCoroutine? Wait 0.83secs (animation lenght) and change that parameters? (true-to false) :S
I think i missunderstanding something