public double getNeededPowerSupplyPerSecondWithMinimumRatio(double supply, double ratio_min, String resourcename, ResourceManager manager = null)
        {
            if (manager == null)
            {
                manager = getManagerForVessel(resourcename);
            }
            if (manager == null)
            {
                Debug.LogError("[KSPI] - failed to find resource Manager For Current Vessel");
                return(0);
            }

            return(manager.getNeededPowerSupplyPerSecondWithMinimumRatio(Math.Max(supply, 0), Math.Max(ratio_min, 0)));
        }
        public double getNeededPowerSupplyPerSecondWithMinimumRatio(double supply, double ratio_min, String resourcename, ResourceManager manager = null)
        {
            if (supply.IsInfinityOrNaN() || ratio_min.IsInfinityOrNaN() || String.IsNullOrEmpty(resourcename))
            {
                Debug.LogError("[KSPI]: getNeededPowerSupplyPerSecondWithMinimumRatio was called with illegal values.");
                return(0);
            }

            if (manager == null)
            {
                manager = getManagerForVessel(resourcename);
            }
            if (manager == null)
            {
                return(0);
            }

            return(manager.getNeededPowerSupplyPerSecondWithMinimumRatio(Math.Max(supply, 0), Math.Max(ratio_min, 0)));
        }
Exemple #3
0
        public double getNeededPowerSupplyPerSecondWithMinimumRatio(double supply, double ratio_min, String resourcename, ResourceManager manager = null)
        {
            if (double.IsNaN(supply) || double.IsInfinity(supply) || double.IsNaN(ratio_min) || double.IsInfinity(ratio_min) || String.IsNullOrEmpty(resourcename))
            {
                Debug.Log("[KSPI] - getNeededPowerSupplyPerSecondWithMinimumRatio was called with illegal values.");
                return(0);
            }

            if (manager == null)
            {
                manager = getManagerForVessel(resourcename);
            }
            if (manager == null)
            {
                Debug.LogError("[KSPI] - failed to find resource Manager For Current Vessel");
                return(0);
            }

            return((double)manager.getNeededPowerSupplyPerSecondWithMinimumRatio(Math.Max(supply, 0), Math.Max(ratio_min, 0)));
        }