예제 #1
0
    IEnumerator Attack()
    {
        while (hasTarget)
        {
            currentState = State.Chasing;
            yield return(new WaitForSeconds(attackCooldown));

            currentState = State.Attacking;

            Vector3 dirToTarget = (target.position - transform.position).normalized;
            if (!dead)
            {
                attackController.Shoot();
                yield return(null);
            }
        }
    }