Beispiel #1
0
        public void DoTheMath()
        {
            // Direct antenna (not-relay)
            nbDirectAntenna     = directAntennaList.Count;
            nbDirectCombAntenna = directCombAntennaList.Count;

            // Direct combinable :
            if (nbDirectCombAntenna > 0)
            {
                rawDirectCombPower = AHUtil.GetVesselPower(directCombAntennaList, false);
                directCombPower    = AHUtil.TruePower(rawDirectCombPower);              //AHUtil.GetVesselPower (directCombAntennaList);
                directCombRange    = AHUtil.GetRange(directCombPower, targetPower);
            }
            else
            {
                rawDirectCombPower = 0;
                directCombPower    = 0;
                directCombRange    = 0;
            }


            // Direct straight :
            if (nbDirectAntenna > 0)
            {
                ModuleDataTransmitter bigDirect = null;
                foreach (ModuleDataTransmitter antenna in directAntennaList)
                {
                    if (bigDirect == null || bigDirect.antennaPower < antenna.antennaPower)
                    {
                        bigDirect = antenna;
                    }
                }
                rawDirectPower    = bigDirect.antennaPower;
                directPower       = AHUtil.TruePower(rawDirectPower);           //AHUtil.TruePower (bigDirect.antennaPower);
                directRange       = AHUtil.GetRange(directPower, targetPower);
                directAntennaName = bigDirect.part.partInfo.title;
            }
            else
            {
                rawDirectPower    = 0;
                directPower       = 0;
                directRange       = 0;
                directAntennaName = "No Antenna";
            }


            // Relay antenna :
            nbRelayAntenna     = relayAntennaList.Count;
            nbRelayCombAntenna = relayCombAntennaList.Count;

            // Relay combinable :
            if (nbRelayCombAntenna > 0)
            {
                rawRelayCombPower = AHUtil.GetVesselPower(relayCombAntennaList, false);
                relayCombPower    = AHUtil.TruePower(rawRelayCombPower);              //AHUtil.GetVesselPower (relayCombAntennaList);
                relayCombRange    = AHUtil.GetRange(relayCombPower, targetPower);
            }
            else
            {
                rawRelayCombPower = 0;
                relayCombPower    = 0;
                relayCombRange    = 0;
            }


            // Relay straight :
            if (nbRelayAntenna > 0)
            {
                ModuleDataTransmitter bigRelay = null;
                foreach (ModuleDataTransmitter antenna in relayAntennaList)
                {
                    if (bigRelay == null || bigRelay.antennaPower < antenna.antennaPower)
                    {
                        bigRelay = antenna;
                    }
                }
                rawRelayPower    = bigRelay.antennaPower;
                relayPower       = AHUtil.TruePower(rawRelayPower);           //AHUtil.TruePower (bigRelay.antennaPower);
                relayRange       = AHUtil.GetRange(relayPower, targetPower);
                relayAntennaName = bigRelay.part.partInfo.title;
            }
            else
            {
                rawRelayPower    = 0;
                relayPower       = 0;
                relayRange       = 0;
                relayAntennaName = "No Antenna";
            }

            FetchBetterAntennas();
            FetchAntennaStatus();
            SetPerPlanetList();

            directDistanceAt100 = AHUtil.GetDistanceAt100(directBetterRange);
            directDistanceAt75  = AHUtil.GetDistanceAt75(directBetterRange);
            directDistanceAt50  = AHUtil.GetDistanceAt50(directBetterRange);
            directDistanceAt25  = AHUtil.GetDistanceAt25(directBetterRange);

            relayDistanceAt100 = AHUtil.GetDistanceAt100(relayBetterRange);
            relayDistanceAt75  = AHUtil.GetDistanceAt75(relayBetterRange);
            relayDistanceAt50  = AHUtil.GetDistanceAt50(relayBetterRange);
            relayDistanceAt25  = AHUtil.GetDistanceAt25(relayBetterRange);
        }