Merge pull request #5405 from RoosterDragon/min-max

Added MinBy, MaxBy, etc.
This commit is contained in:
Paul Chote
2014-06-09 17:42:01 +12:00
16 changed files with 90 additions and 47 deletions

View File

@@ -69,8 +69,7 @@ namespace OpenRA.Mods.RA.Air
var side = new WVec(-fwd.Y, fwd.X, fwd.Z);
var approachDelta = self.CenterPosition - approachStart;
var sideTowardBase = new[] { side, -side }
.OrderBy(a => WVec.Dot(a, approachDelta))
.First();
.MinBy(a => WVec.Dot(a, approachDelta));
// Calculate the tangent line that joins the turning circles at the current and approach positions
var cp = self.CenterPosition + turnRadius * sideTowardBase / 1024;