public override NodeState GetState()
    {
        if (!started)
        {
            started    = true;
            shoottimer = Random.Range(1.5f, 2.5f);

            return(NodeState.Running);
        }
        if (started)
        {
            shoottimer           -= Time.deltaTime;
            bot.pointer           = bot.body.weapon.pointer;
            bot.pointer.TargetPos = (aimTarget - bot.pointer.ForcePoint);
            bot.pointer.BalanceForces(bot.body.weapon.transform.position);
            // Debug.Log("SHOOT TIMER: " + shoottimer);
            if (shoottimer <= 0)
            {
                // Debug.Log("SHould Shoot");
                ((RangedWeapon)bot.body.weapon).Trigger();
                started = false;
                bot.Brace(false);
                bot.Hold(false);
                return(NodeState.Success);
            }
            return(NodeState.Running);
        }
        return(NodeState.Success);
    }
    public override NodeState GetState()
    {
        if (!bot.attackTarget)
        {
            return(NodeState.Failure);
        }

        shoottimer -= Time.deltaTime;
        //bot.Move (aimTarget);
        bot.pointer           = bot.body.weapon.pointer;
        bot.pointer.TargetPos = (aimTarget - bot.pointer.ForcePoint);
        bot.pointer.BalanceForces(bot.body.weapon.transform.position);
        if (shoottimer <= 0)
        {
            shoottimer = Vector2.Distance(bot.transform.position, bot.attackTarget.transform.position) * scaleFactor;
            shoottimer = Mathf.Clamp(shoottimer, 2, 7) + Random.Range(0.5f, 1.2f);
            aimTarget  = (Vector2)bot.attackTarget.transform.position;// + Random.insideUnitCircle * Mathf.Tan (0.5f);
            ((RangedWeapon)bot.body.weapon).Trigger();
            bot.Brace(false);
            bot.Hold(false);
            return(NodeState.Success);
        }

        return(NodeState.Running);
    }
 public override NodeState GetState()
 {
     if (!bot.attackTarget)
     {
         return(NodeState.Failure);
     }
     if (!started)
     {
         bot.Hold();
         started = true;
     }
     timer    -= Time.deltaTime;
     target    = bot.attackTarget.transform;
     targetPos = (pos.position - target.position).normalized * prefDist;
     bot.Move(targetPos);
     if (timer <= 0)
     {
         timer   = timerMax;
         started = false;
         bot.Hold(false);
         return((Mathf.Abs(prefDist - Vector2.Distance(pos.position, targetPos)) < leeway) ? NodeState.Success : NodeState.Failure);
     }
     return(NodeState.Running);
 }