private IEnumerator AttackBehaviour() { int times = Random.Range(0, 3); while (times > 0) { character.FacePosition(player.transform.position); times--; character.Attack(); yield return(new WaitForSeconds(Random.Range(0.5f, 1f))); } ChangeState(AIState.Alert); }