I cannot understand why the coroutines are not waiting the designated number of seconds before executing the code below it. At the moment, the animation bleeds into the next state. I could get around this by using .time and if statements but I thought the whole point of coroutines is that you can avoid that sort of mess.
public IEnumerator LoadBow()
{
this.gameObject.GetComponent<Animation>().CrossFade("Load_Bow");
yield return new WaitForSeconds(this.gameObject.GetComponent<Animation>()["Load_Bow"].length);
aimStates = AimStates.Draw;
}
public IEnumerator DrawBow()
{
this.gameObject.GetComponent<Animation>().CrossFade("Draw_Bow");
yield return new WaitForSeconds(this.gameObject.GetComponent<Animation>()["Draw_Bow"].length);
aimStates = AimStates.Aim;
}
public void Aiming()
{
moveTarget.SetActive(false);
switch(aimStates)
{
case AimStates.Load:
StartCoroutine(LoadBow());
break;
case AimStates.Draw:
StartCoroutine(DrawBow());
break;