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 (!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);
     }
     if (!started)
     {
         started = true;
         Vector2 target = ((Vector2)bot.attackTarget.transform.position - body.weapon.pointer.ForcePoint).normalized;
         target = bot.transform.InverseTransformDirection(target);
         target = new Vector2(target.x + UnityEngine.Random.Range(-0.1f, 0.1f), target.y).normalized;
         bot.Move(bot.transform.TransformDirection(target));
     }
     timer -= Time.deltaTime;
     bot.Brace();
     if (timer <= 0)
     {
         timer   = UnityEngine.Random.Range(0.4f, timerMax);
         started = false;
         return(NodeState.Success);
     }
     return(NodeState.Running);
 }