Created
July 28, 2018 22:58
-
-
Save MatthewBlanchard/6eb837ab858edacc61fd3ad29c0364dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void CheckRange() | |
{ | |
InArcInfo = new Dictionary<GenericArc, bool>(); | |
List<System.Type> WeaponArcRestrictions = (Weapon is GenericSecondaryWeapon) ? (Weapon as GenericSecondaryWeapon).ArcRestrictions : null; | |
WeaponTypes weaponType = (Weapon is GenericSecondaryWeapon) ? (Weapon as GenericSecondaryWeapon).WeaponType : WeaponTypes.PrimaryWeapon; | |
foreach (var arc in Ship1.ArcInfo.Arcs) | |
{ | |
ShotInfoArc shotInfoArc = new ShotInfoArc(Ship1, Ship2, arc); | |
InArcInfo.Add(arc, shotInfoArc.InArc); | |
if (!arc.ShotPermissions.CanShootByWeaponType(weaponType)) | |
continue; | |
if (WeaponArcRestrictions != null && !WeaponArcRestrictions.Contains(arc.GetType())) | |
continue; | |
if (shotInfoArc.IsShotAvailable) | |
{ | |
if (IsShotAvailable == false) | |
{ | |
MinDistance = shotInfoArc.MinDistance; | |
} | |
else | |
{ | |
if (shotInfoArc.MinDistance.DistanceReal < MinDistance.DistanceReal) MinDistance = shotInfoArc.MinDistance; | |
} | |
IsShotAvailable = true; | |
} | |
if (NearestFailedDistance == null) | |
{ | |
NearestFailedDistance = shotInfoArc.MinDistance; | |
} | |
else if (shotInfoArc.MinDistance.DistanceReal < NearestFailedDistance.DistanceReal) | |
{ | |
NearestFailedDistance = shotInfoArc.MinDistance; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment