Example #1
0
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        #region Movements
        boss.LookAtPlayer();

        boss.FollowPlayer();

        jump.Jump();
        #endregion

        #region Attack
        if (Vector2.Distance(player.position, rb.position) <= attackRange && timer <= 0f)
        {
            animator.SetTrigger("Attacking");
            timer = 2f;
        }
        else
        {
            timer -= Time.deltaTime;
        }
        #endregion
    }