void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         if (m_bossController != null)
         {
             m_bossController.Attack();
         }
     }
 }
Example #2
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (timer >= attackDelay)
        {
            controller.Attack();
            timer = 0;
        }

        if (grudge.HasTarget())
        {
            if (!fov.IsVisible(grudge.GetTarget()))
            {
                animator.SetTrigger("Pursuit");
            }
        }
        else
        {
            animator.SetTrigger("Wander");
        }

        timer += Time.deltaTime;
    }