Use Tuple syntax

This commit is contained in:
teinarss
2020-08-02 13:41:03 +02:00
committed by Paul Chote
parent 8a74f6ea18
commit 19b02875c7
90 changed files with 738 additions and 826 deletions

View File

@@ -61,18 +61,18 @@ namespace OpenRA.Mods.Common.Warheads
var closestActiveShape = victim.TraitsImplementing<HitShape>()
.Where(Exts.IsTraitEnabled)
.Select(s => Pair.New(s, s.DistanceFromEdge(victim, pos)))
.MinByOrDefault(s => s.Second);
.Select(s => (HitShape: s, Distance: s.DistanceFromEdge(victim, pos)))
.MinByOrDefault(s => s.Distance);
// Cannot be damaged without an active HitShape.
if (closestActiveShape.First == null)
if (closestActiveShape.HitShape == null)
continue;
var falloffDistance = 0;
switch (DamageCalculationType)
{
case DamageCalculationType.HitShape:
falloffDistance = closestActiveShape.Second.Length;
falloffDistance = closestActiveShape.Distance.Length;
break;
case DamageCalculationType.ClosestTargetablePosition:
falloffDistance = victim.GetTargetablePositions().Select(x => (x - pos).Length).Min();
@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Warheads
ImpactOrientation = impactOrientation,
};
InflictDamage(victim, firedBy, closestActiveShape.First, updatedWarheadArgs);
InflictDamage(victim, firedBy, closestActiveShape.HitShape, updatedWarheadArgs);
}
}