private void Walk() { curSpeed = speed * Time.deltaTime; targetPoint = path.GetPoint(curPathIndex); //if path point reached, move to next point if (Vector3.Distance(transform.position, targetPoint) < path.Radius) { currentState = DobbitState.Action; StartCoroutine("Action"); if (curPathIndex < pathLength - 1) { curPathIndex++; } else { curPathIndex = 0; } } velocity += Steer(targetPoint); transform.position += velocity; }
IEnumerator Action() { ChangeAnimation(actionAnim); yield return(new WaitForSeconds(4)); ChangeAnimation(walkAnim); currentState = DobbitState.Walk; }