Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public double DistanceToNextPoint()
 {
     return(TDMath.RangeToTarget(this.Location, this.Path.PathPoints[NextPoint].Location));
 }