void Update()
    {
        if (isAttacking)
        {
            if (!agent.hasPath)
            {
                //patrol.GotoNextPoint();
                patrol.AttackNextPoint(target.position);
            }
            attackTime -= 0.15f;
            if (attackTime <= 0f)
            {
                NotAttack();
            }
            hidingEye.fillAmount = attackTime / maxTime;
            //Debug.Log(attackTime / maxTime);
        }
        else
        {
            // attackTime = 0f;
        }
        //fwd = transform.TransformDirection(Vector3.forward) * lookRadius * 1.7f;
        fwd  = target.position - transform.position;
        dest = transform.position + transform.forward * lookRadius / 1.5f;
        dist = transform.position + transform.forward * lookRadius * 1.7f;


        float distance  = Vector3.Distance(target.position, dest);
        float distance2 = Vector3.Distance(target.position, transform.position);

        if (distance <= lookRadius || isAttacking)
        {
            //Idle();
            //FaceTarget();
            //agent.SetDestination(agent.destination);
            bool hiding = playerController.CheckHiding();
            if (!hiding)
            {
                targetHit = Physics.Raycast(transform.position, fwd, out tHit, lookRadius * 1.7f);
                //targetHit = Physics.BoxCast(transform.position, transform.localScale*3, fwd, out tHit, transform.rotation, lookRadius * 1.7f);
                if (targetHit)
                {
                    // Debug.Log(tHit.transform.name);
                    if (tHit.transform == target.transform)
                    {
                        MomAttack();
                        if (notSee >= 5f)
                        {
                            patrol.Attack2();
                            notSee = 0f;
                        }
                    }
                    else
                    {
                        notSee  += 0.1f;
                        isHidden = true;
                        //Debug.Log(tHit.transform.name);
                        //isAttacking = false;
                    }
                }
                if (distance2 <= agent.stoppingDistance)
                {
                    if (targetStats != null)
                    {
                        animator.SetBool("eating", true);
                        combat.Attack(targetStats);
                    }

                    FaceTarget();
                }
                else
                {
                    animator.SetBool("eating", false);
                }
                if (isAttacking)
                {
                    if (attackTime <= 0f)
                    {
                        patrol.AttackNextPoint(target.position);
                        // attackTime = 100f;
                    }

                    //agent.SetDestination(target.position);
                }
                if (notSee >= 100f)
                {
                    notSee = 0f;
                    NotAttack();
                    patrol.NotAttack();
                    patrol.GotoNextPoint();
                }
            }
            else if (distance2 <= agent.stoppingDistance)
            {
                MomAttack();

                /*
                 * notSee = 0f;
                 * if (isAttacking)
                 * {
                 *  if (attackTime <= 30f)
                 *  {
                 *      isAttacking = false;
                 *      NotAttack();
                 *      patrol.AttackNextPoint(target.position);
                 *      attackTime = 0f;
                 *  }
                 *  else if (attackTime == 0f && notSee == 0f)
                 *  {
                 *      patrol.NotAttack();
                 *  }
                 *
                 *  //agent.SetDestination(target.position);
                 * }
                 */
            }
        }
    }