コード例 #1
0
 public override NodeState GetState()
 {
     if (!bot.attackTarget)
     {
         return(NodeState.Failure);
     }
     if (!started)
     {
         started = true;
     }
     timer -= Time.deltaTime;
     bot.Dash();
     bot.Move(bot.attackTarget.transform.position);
     if (timer <= 0)
     {
         timer   = timerMax;
         started = false;
         return(NodeState.Success);
     }
     return(NodeState.Running);
 }
コード例 #2
0
 public override NodeState GetState()
 {
     if (!bot.attackTarget)
     {
         return(NodeState.Failure);
     }
     if (!started)
     {
         target         = bot.attackTarget.transform;
         recenterTarget = (Vector2)target.position + (Random.insideUnitCircle * recenterDist);
         started        = true;
     }
     timer -= Time.deltaTime;
     bot.Dash();
     bot.Move(recenterTarget);
     if (timer <= 0)
     {
         timer   = timerMax + Random.Range(-1f, 1f);
         started = false;
         return(NodeState.Success);
     }
     return(NodeState.Running);
 }
コード例 #3
0
 public override NodeState GetState()
 {
     if (!bot.attackTarget)
     {
         return(NodeState.Failure);
     }
     if (!started)
     {
         target = bot.attackTarget.transform;
         Vector2 worldTarget = (target.position - bot.transform.position).normalized * 50;
         chargeTarget = bot.transform.TransformPoint(worldTarget);
         started      = true;
     }
     timer -= Time.deltaTime;
     bot.Dash();
     bot.Move(chargeTarget);
     if (timer <= 0)
     {
         timer   = timerMax + Random.Range(-1f, 1f);
         started = false;
         return(NodeState.Success);
     }
     return(NodeState.Running);
 }
コード例 #4
0
 public override NodeState GetState()
 {
     bot.Move(new Vector2(bot.transform.position.x, bot.squad.direction * -10000));
     bot.Dash();
     return(NodeState.Running);
 }