public AIAttacks WillAttack()
        {
            int w = 0;
            List <AIAttacks> l = new List <AIAttacks> ();

            for (int i = 0; i < ai_attacks.Length; i++)
            {
                AIAttacks a = ai_attacks [i];
                if (a._cool > 0)
                {
                    a._cool -= delta;
                    if (a._cool < 0)
                    {
                        a._cool = 0;
                    }
                    continue;
                }

                if (dis > a.minDistance)
                {
                    continue;
                }
                if (angle < a.minAngle)
                {
                    continue;
                }
                if (angle > a.maxAngle)
                {
                    continue;
                }
                if (a.weight == 0)
                {
                    continue;
                }

                w += a.weight;
                l.Add(a);
            }

            if (l.Count == 0)
            {
                return(null);
            }

            int ran = Random.Range(0, w + 1);
            int c_w = 0;

            for (int i = 0; i < l.Count; i++)
            {
                c_w += l [i].weight;
                if (c_w > ran)
                {
                    return(l[i]);
                }
            }
            return(null);
        }
        void InSight()
        {
            LookTowardsTarget();
            // HandelCooldowns();

            //if(_attack > 0)
            //{
            //    _attack--;
            //    return;
            //}
            //_attack = attackCount;

            float d2 = Vector3.Distance(estates.targetDestination, target.position);

            if (d2 > 2 || dis > sight * .5)
            {
                GoToTarget();
            }
            if (dis < 2)
            {
                estates.agent.isStopped = true;
            }

            AIAttacks attack = WillAttack();

            if (attack != null)
            {
                aiState = AIstate.attacking;

                estates.anim.Play(attack.targetAnim);
                estates.anim.SetBool("canMove", false);                  //I NEED TO DO HIS STATICSTRINGS CLASS
                estates.canMove         = false;
                attack._cool            = attack.coolDown;
                estates.agent.isStopped = true;
                // estates.agent.enabled = false;
                return;
            }
        }