Beispiel #1
0
        public static bool CheckInRange(GenericShip thisShip, GenericShip anotherShip, int minRange, int maxRange, RangeCheckReason reason = RangeCheckReason.Other)
        {
            DistanceInfo distInfo = new DistanceInfo(thisShip, anotherShip);
            bool         inRange  = distInfo.Range >= minRange && distInfo.Range <= maxRange;

            inRange = thisShip.CallOnCheckRange(anotherShip, minRange, maxRange, reason, inRange);

            return(inRange);
        }
Beispiel #2
0
 private void CheckCoordinateRangeModification(GenericShip anotherShip, int minRange, int maxRange, RangeCheckReason reason, ref bool isInRange)
 {
     if (reason == RangeCheckReason.CoordinateAction && anotherShip.ActionBar.HasAction(typeof(CalculateAction)))
     {
         DistanceInfo distInfo = new DistanceInfo(HostShip, anotherShip);
         if (distInfo.Range > 2)
         {
             isInRange = true;
         }
     }
 }
Beispiel #3
0
 private void CheckRangeModification(GenericShip anotherShip, int minRange, int maxRange, RangeCheckReason reason, ref bool isInRange)
 {
     if ((anotherShip.Owner.PlayerNo == HostShip.Owner.PlayerNo) &&
         (reason == RangeCheckReason.CoordinateAction || reason == RangeCheckReason.UpgradeCard) &&
         (minRange >= 0 || maxRange <= 1)
         )
     {
         DistanceInfo distInfo = new DistanceInfo(HostShip, anotherShip);
         if (distInfo.Range >= 2 && distInfo.Range <= 3)
         {
             isInRange = true;
         }
     }
 }