private TDAttacker GetFarAttacker(List <TDAttacker> atts) { TDAttacker result = atts[0]; double farthestRange = 0; double rangeToThis = 0; foreach (TDAttacker a in atts) { rangeToThis = TDMath.RangeToTarget(this.Location, a.Location); if (rangeToThis > farthestRange) { farthestRange = rangeToThis; result = a; } } return(result); }
private TDAttacker GetCloseAttacker(List <TDAttacker> atts) { TDAttacker result = atts[0]; double closestRange = 0; double rangeToThis = 0; foreach (TDAttacker a in atts) { rangeToThis = TDMath.RangeToTarget(this.Location, a.Location); if (closestRange == 0 || rangeToThis < closestRange) { closestRange = rangeToThis; result = a; } } return(result); }
public double DistanceToNextPoint() { return(TDMath.RangeToTarget(this.Location, this.Path.PathPoints[NextPoint].Location)); }