Beispiel #1
0
        private static void UpdateBuildRates()
        {
            if (!_ratesUpdated)
            {
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    if (ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.VehicleAssemblyBuilding) >= 0)
                    {
                        _ratesUpdated = true;
                        KCTDebug.Log("Updating build rates");
                        foreach (KSCItem KSC in KCTGameStates.KSCs)
                        {
                            KSC?.RecalculateBuildRates();
                            KSC?.RecalculateUpgradedBuildRates();
                        }

                        KCTDebug.Log("Rates updated");

                        foreach (SpaceCenterFacility facility in Enum.GetValues(typeof(SpaceCenterFacility)))
                        {
                            KCTGameStates.BuildingMaxLevelCache[facility.ToString()] = ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility);
                            KCTDebug.Log($"Cached {facility} max at {KCTGameStates.BuildingMaxLevelCache[facility.ToString()]}");
                        }
                    }
                }
                else
                {
                    _ratesUpdated = true;
                }
            }
        }
Beispiel #2
0
        private IEnumerator UpdateBuildRates()
        {
            do
            {
                yield return(new WaitForFixedUpdate());    // No way to know when KSP has finally initialized the ScenarioUpgradeableFacilities data
            } while (HighLogic.LoadedScene == GameScenes.SPACECENTER && ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.VehicleAssemblyBuilding) < 0);

            if (HighLogic.LoadedScene == GameScenes.SPACECENTER &&
                ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.VehicleAssemblyBuilding) >= 0)
            {
                KCTDebug.Log("Updating build rates");
                foreach (KSCItem KSC in KCTGameStates.KSCs)
                {
                    KSC?.RecalculateBuildRates();
                    KSC?.RecalculateUpgradedBuildRates();
                }

                KCTDebug.Log("Rates updated");

                foreach (SpaceCenterFacility facility in Enum.GetValues(typeof(SpaceCenterFacility)))
                {
                    KCTGameStates.BuildingMaxLevelCache[facility.ToString()] = ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility);
                    KCTDebug.Log($"Cached {facility} max at {KCTGameStates.BuildingMaxLevelCache[facility.ToString()]}");
                }
            }
        }
Beispiel #3
0
        public override bool RequirementMet(ConfiguredContract contract)
        {
            int level = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(facility) *
                                        ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility)) + 1;

            return(level == 0 && contract != null && contract.ContractState == Contracts.Contract.State.Active ||
                   level >= minLevel && level <= maxLevel);
        }
Beispiel #4
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary> Calculates the level (1..3) of the facility specified.</summary>
        ///
        /// <param name="facility"> The facility to fetch the level for.</param>
        ///
        /// <returns> The level of the facility. This will be 1..3 where 1 is the initial level on a new
        ///           career game and 3 is fully upgraded.</returns>
        private int FacilityLevel(SpaceCenterFacility facility)
        {
            var level = ScenarioUpgradeableFacilities.GetFacilityLevel(facility); // 0 .. 1
            var count = ScenarioUpgradeableFacilities
                        .GetFacilityLevelCount(facility);                         // max upgrades allowed (usually 2)

            return((int)(level * count) + 1);
        }
Beispiel #5
0
        public bool RequirementMet(out string unmetReason)
        {
            int currentLevel = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(facility) *
                                               ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility)) + 1;

            unmetReason = "Current level: " + currentLevel;
            return(currentLevel >= level);
        }
Beispiel #6
0
        /// <summary>
        /// Obtains the current upgrade level of a facility.
        /// </summary>
        /// <param name="facilityName">The name of the facility.</param>
        /// <returns>A value indicating the current upgrade level.</returns>
        private static FacilityLevels GetFacilityLevel(string facilityName)
        {
            var levelCount = ScenarioUpgradeableFacilities.GetFacilityLevelCount(facilityName);
            var facility   = PSystemSetup.Instance.GetSpaceCenterFacility(facilityName.Split('/').Last());
            var rawLevel   = facility.GetFacilityLevel();

            var level = (levelCount == 1) ? FacilityLevels.Level_3 : LevelConversion[rawLevel];

            //$"Facility {facilityName} levelCount={levelCount} raw level={rawLevel} level={level}".Debug();
            return(level);
        }
        public override bool RequirementMet(ConfiguredContract contract)
        {
            // Don't check active contracts in any scene but space center
            if (HighLogic.LoadedScene != GameScenes.SPACECENTER && contract != null && contract.ContractState == Contracts.Contract.State.Active)
            {
                return(true);
            }

            int level = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(facility) *
                                        ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility)) + 1;

            return(level >= minLevel && level <= maxLevel);
        }
Beispiel #8
0
        /// <summary>
        /// Gets the (integer) level of a particular facility
        /// </summary>
        /// <param name="facility">The facility to check</param>
        /// <returns>The level of the facility</returns>
        public static int GetFacilityLevel(SpaceCenterFacility facility)
        {
            int lvl = 0;

            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
            {
                lvl = (int)(ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility) * ScenarioUpgradeableFacilities.GetFacilityLevel(facility));
            }
            else
            {
                lvl = ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility); //returns 2 for VAB in Sandbox
            }
            return(lvl);
        }
        public static int BuildingUpgradeLevel(SpaceCenterFacility facility)
        {
            int lvl = 0;

            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER && Settings1.Instance.UseUpgrades)
            {
                lvl = (int)Math.Round((ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility) * ScenarioUpgradeableFacilities.GetFacilityLevel(facility)));
            }
            else
            {
                lvl = ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility); //returns 2 for VAB in Sandbox
            }
            return(lvl);
        }
Beispiel #10
0
        private int GetFacilityLevel(SpaceCenterFacility facility)
        {
            if (ScenarioUpgradeableFacilities.Instance == null || !ScenarioUpgradeableFacilities.Instance.enabled)
            {
                return(int.MaxValue);
            }


            double maxlevel = ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility);

            if (maxlevel <= 0)
            {
                maxlevel = 2;                                                                                 // not sure why, but GetFacilityLevelCount return -1 in career
            }
            return((int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(facility) * maxlevel + 1)); // They start counting at 0
        }
        public static int ContractLimit(Contract.ContractPrestige prestige)
        {
            int level = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.MissionControl) *
                                        ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.MissionControl));
            float rep = Reputation.Instance.reputation;

            switch (prestige)
            {
            case Contract.ContractPrestige.Trivial:
                return(Math.Max(2, (int)Math.Round((rep + rep * level / 3) / 200 + 6 + level)));

            case Contract.ContractPrestige.Significant:
                return(Math.Max(1, (int)Math.Round((rep + rep * level / 3) / 250 + 4 + level)));

            case Contract.ContractPrestige.Exceptional:
                return(Math.Max(0, (int)Math.Round((rep + rep * level / 3) / (1000 / 3.0) + 2 + level)));
            }
            return(0);
        }
        public static int ContractLimit(Contract.ContractPrestige prestige)
        {
            int level = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.MissionControl) *
                                        ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.MissionControl));
            float rep  = Reputation.Instance.reputation;
            float mult = HighLogic.CurrentGame.Parameters.CustomParams <ContractConfiguratorParameters>().ActiveContractMultiplier;

            switch (prestige)
            {
            case Contract.ContractPrestige.Trivial:
                return(Math.Max(2, (int)Math.Round((rep + rep * level / 3) * mult / 200 + 6 + level)));

            case Contract.ContractPrestige.Significant:
                return(Math.Max(1, (int)Math.Round((rep + rep * level / 3) * mult / 250 + 4 + level)));

            case Contract.ContractPrestige.Exceptional:
                return(Math.Max(0, (int)Math.Round((rep + rep * level / 3) * mult / (1000 / 3.0) + 2 + level)));
            }
            return(0);
        }
        IEnumerator <YieldInstruction> FixStrategyText(KSCFacilityContextMenu menu)
        {
            int currentLevel = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Administration) *
                                               ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.Administration)) + 1;

            string currentLevelText = StringBuilderCache.Format("* Max Active Strategies: {0}", currentLevel);
            string nextLevelText    = StringBuilderCache.Format("<color=#a8ff04>* Max Active Strategies: {0}</color>", currentLevel + 1);

            while (true)
            {
                if (!menu)
                {
                    yield break;
                }

                menu.levelStatsText.text = menu.levelStatsText.text.StartsWith("<color") ? nextLevelText : currentLevelText;

                yield return(null);
            }
        }
        public override void OnUpdate()
        {
            // Need to do this on update, as the part module gets loaded before the scenario
            if (fishingData == null && SportsScenario.Instance != null)
            {
                fishingData = SportsScenario.Instance.GetFishingData(pcm);
                fishRecord  = fishingData.BiggestFish(vessel.mainBody);
                fishCount   = fishingData.FishCount(vessel.mainBody);
            }

            if (vessel.situation != Vessel.Situations.LANDED || !vessel.mainBody.ocean || vessel.altitude > 250)
            {
                SetShowing(false);
            }
            // Perform the more expensive check
            else
            {
                // Check 5 meters forward for water
                Vector3 checkPosition = vessel.transform.localPosition + vessel.transform.forward * 5.0f;
                double  latitude      = vessel.mainBody.GetLatitude(checkPosition);
                double  longitude     = vessel.mainBody.GetLongitude(checkPosition);
                double  height        = Util.TerrainHeight(vessel.mainBody, latitude, longitude);

                int adminLevel = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Administration) *
                                                 ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.Administration)) + 1;

                if (height <= 0.0 || adminLevel == 3 && Util.adminPool.Contains(new Vector2((float)latitude, (float)longitude)))
                {
                    SetShowing(true);

                    // Set the fish type found at the current location
                    Fish.FishType ft = Fish.GetFishType(vessel.mainBody, vessel.latitude, vessel.longitude);
                    fishType = ft.Name();
                }
                else
                {
                    SetShowing(false);
                }
            }
        }
Beispiel #15
0
        protected virtual string GenerateRequirementText()
        {
            string result = "";

            // Write out stock-based requirements
            result += "\n<b><color=#feb200>Requirements:</color></b>\n\n";
            if (InitialCostFunds > 0)
            {
                double currentFunds = Funding.Instance.Funds;
                bool   fundsMet     = Math.Round(currentFunds) >= Math.Round(InitialCostFunds);
                string text         = "At least " + InitialCostFunds.ToString("N0") + " funds";
                if (!fundsMet)
                {
                    text += " (Current funds: " + Math.Round(currentFunds) + ")";
                }
                result += RequirementText(text, fundsMet);
            }
            if (InitialCostScience > 0)
            {
                double currentScience = ResearchAndDevelopment.Instance.Science;
                bool   scienceMet     = Math.Round(currentScience) >= Math.Round(InitialCostScience);
                string text           = "At least " + InitialCostScience.ToString("N0") + " science";
                if (!scienceMet)
                {
                    text += " (Current science: " + Math.Round(currentScience) + ")";
                }
                result += RequirementText(text, scienceMet);
            }
            if (RequiredReputation > -1000 || InitialCostReputation > 0)
            {
                float  reputationNeeded  = Math.Max(RequiredReputation, InitialCostReputation > 0 ? InitialCostReputation : -1000);
                float  currentReputation = Reputation.Instance.reputation;
                bool   repMet            = Math.Round(currentReputation) >= Math.Round(reputationNeeded);
                string text = "At least " + reputationNeeded.ToString("N0") + " reputation";
                if (!repMet)
                {
                    text += " (Current reputation: " + Math.Round(currentReputation) + ")";
                }
                result += RequirementText(text, repMet);
            }
            int minFacilityLevel = MinimumFacilityLevel();

            if (minFacilityLevel > 1)
            {
                int currentLevel = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Administration) *
                                                   ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.Administration)) + 1;
                result += RequirementText("Administration Facility Level " + minFacilityLevel,
                                          currentLevel >= minFacilityLevel);
            }

            // Requirements from strategies
            foreach (StrategyEffect effect in Effects)
            {
                IRequirementEffect requirementEffect = effect as IRequirementEffect;
                if (requirementEffect != null)
                {
                    string unmetReason;
                    bool   requirementMet = requirementEffect.RequirementMet(out unmetReason);
                    string text           = requirementEffect.RequirementText();
                    if (!requirementMet && !string.IsNullOrEmpty(unmetReason))
                    {
                        text += " (" + unmetReason + ")";
                    }
                    result += RequirementText(text, requirementMet);
                }
            }

            return(result);
        }
Beispiel #16
0
        public void FixedUpdate()
        {
            if (KCT_Utilities.CurrentGameIsMission())
            {
                return;
            }

            double lastUT = KCT_GameStates.UT > 0 ? KCT_GameStates.UT : Planetarium.GetUniversalTime();

            KCT_GameStates.UT = Planetarium.GetUniversalTime();
            try
            {
                // No need to set this true or false every single fixed upate
                // Actually not needed anymore not that the ToolbarController is handling it
#if false
                if (KCT_GUI.clicked && KCT_GameStates.toolbarControl != null)
                {
                    KCT_GameStates.toolbarControl.SetTrue(false);
                }
                else
                {
                    KCT_GameStates.toolbarControl.SetFalse(false);
                }
#endif
                if (!KCT_PresetManager.Instance.ActivePreset.generalSettings.Enabled)
                {
                    return;
                }

                if (!KCT_GameStates.erroredDuringOnLoad.AlertFired && KCT_GameStates.erroredDuringOnLoad.HasErrored())
                {
                    KCT_GameStates.erroredDuringOnLoad.FireAlert();
                }

                if (KCT_GameStates.UpdateLaunchpadDestructionState)
                {
                    KCTDebug.Log("Updating launchpad destruction state.");
                    KCT_GameStates.UpdateLaunchpadDestructionState = false;
                    KCT_GameStates.ActiveKSC.ActiveLPInstance.SetDestructibleStateFromNode();
                    if (KCT_GameStates.ActiveKSC.ActiveLPInstance.upgradeRepair)
                    {
                        //repair everything, then update the node
                        KCT_GameStates.ActiveKSC.ActiveLPInstance.RefreshDestructionNode();
                        KCT_GameStates.ActiveKSC.ActiveLPInstance.CompletelyRepairNode();
                        KCT_GameStates.ActiveKSC.ActiveLPInstance.SetDestructibleStateFromNode();
                    }
                }

                if (!ratesUpdated)
                {
                    if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                    {
                        if (ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.VehicleAssemblyBuilding) >= 0)
                        {
                            ratesUpdated = true;
                            KCTDebug.Log("Updating build rates");
                            foreach (KCT_KSC KSC in KCT_GameStates.KSCs)
                            {
                                KSC?.RecalculateBuildRates();
                                KSC?.RecalculateUpgradedBuildRates();
                            }

                            KCTDebug.Log("Rates updated");

                            foreach (SpaceCenterFacility facility in Enum.GetValues(typeof(SpaceCenterFacility)))
                            {
                                KCT_GameStates.BuildingMaxLevelCache[facility.ToString()] = ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility);
                                KCTDebug.Log("Cached " + facility.ToString() + " max at " + KCT_GameStates.BuildingMaxLevelCache[facility.ToString()]);
                            }
                        }
                    }
                    else
                    {
                        ratesUpdated = true;
                    }
                }

                if (KCT_GameStates.ActiveKSC?.ActiveLPInstance != null && HighLogic.LoadedScene == GameScenes.SPACECENTER && KCT_Utilities.CurrentGameIsCareer())
                {
                    if (lvlCheckTimer++ > 30)
                    {
                        lvlCheckTimer = 0;
                        if (KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.LaunchPad) != KCT_GameStates.ActiveKSC.ActiveLPInstance.level)
                        {
                            KCT_GameStates.ActiveKSC.SwitchLaunchPad(KCT_GameStates.ActiveKSC.ActiveLaunchPadID, false);
                            KCT_GameStates.UpdateLaunchpadDestructionState = true;
                        }
                    }
                }
                //Warp code
                if (!KCT_GUI.PrimarilyDisabled && (HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.TRACKSTATION))
                {
                    IKCTBuildItem ikctItem = KCT_Utilities.NextThingToFinish();
                    if (KCT_GameStates.targetedItem == null && ikctItem != null)
                    {
                        KCT_GameStates.targetedItem = ikctItem;
                    }
                    double remaining = ikctItem != null?ikctItem.GetTimeLeft() : -1;

                    double dT = TimeWarp.CurrentRate / (KCT_GameStates.UT - lastUT);
                    if (dT >= 20)
                    {
                        dT = 0.1;
                    }
                    //KCTDebug.Log("dt: " + dT);
                    int nBuffers = 1;
                    if (KCT_GameStates.canWarp && ikctItem != null && !ikctItem.IsComplete())
                    {
                        int warpRate = TimeWarp.CurrentRateIndex;
                        if (warpRate < KCT_GameStates.lastWarpRate) //if something else changes the warp rate then release control to them, such as Kerbal Alarm Clock
                        {
                            KCT_GameStates.canWarp      = false;
                            KCT_GameStates.lastWarpRate = 0;
                        }
                        else
                        {
                            if (ikctItem == KCT_GameStates.targetedItem && warpRate > 0 && TimeWarp.fetch.warpRates[warpRate] * dT * nBuffers > Math.Max(remaining, 0))
                            {
                                int newRate = warpRate;
                                //find the first rate that is lower than the current rate
                                while (newRate > 0)
                                {
                                    if (TimeWarp.fetch.warpRates[newRate] * dT * nBuffers < remaining)
                                    {
                                        break;
                                    }
                                    newRate--;
                                }
                                KCTDebug.Log("Warping down to " + newRate + " (delta: " + (TimeWarp.fetch.warpRates[newRate] * dT) + ")");
                                TimeWarp.SetRate(newRate, true); //hopefully a faster warp down than before
                                warpRate = newRate;
                            }
                            else if (warpRate == 0 && KCT_GameStates.warpInitiated)
                            {
                                KCT_GameStates.canWarp       = false;
                                KCT_GameStates.warpInitiated = false;
                                KCT_GameStates.targetedItem  = null;
                            }
                            KCT_GameStates.lastWarpRate = warpRate;
                        }
                    }
                    else if (ikctItem != null && ikctItem == KCT_GameStates.targetedItem && (KCT_GameStates.warpInitiated || KCT_GameStates.settings.ForceStopWarp) && TimeWarp.CurrentRateIndex > 0 && (remaining < 1) && (!ikctItem.IsComplete())) //Still warp down even if we don't control the clock
                    {
                        TimeWarp.SetRate(0, true);
                        KCT_GameStates.warpInitiated = false;
                        KCT_GameStates.targetedItem  = null;
                    }
                }

                if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
                {
                    KCT_Utilities.SetActiveKSCToRSS();
                }

                if (!KCT_GUI.PrimarilyDisabled && HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    if (KSP.UI.Screens.VesselSpawnDialog.Instance != null && KSP.UI.Screens.VesselSpawnDialog.Instance.Visible)
                    {
                        KSP.UI.Screens.VesselSpawnDialog.Instance.ButtonClose();
                        KCTDebug.Log("Attempting to close spawn dialog!");
                    }
                }

                if (!KCT_GUI.PrimarilyDisabled)
                {
                    KCT_Utilities.ProgressBuildTime();
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }
Beispiel #17
0
 private void OnVesselRollout(ShipConstruct ship)
 {
     if (!BudgetSettings.instance.launchCostsEnabled)
     {
         return;
     }
     if (ship.shipFacility == EditorFacility.VAB)
     {
         launchCosts += BudgetSettings.instance.launchCostsVAB * ((int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.LaunchPad) * ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.LaunchPad)) + 1);
     }
     else
     {
         launchCosts += BudgetSettings.instance.launchCostsSPH * ((int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Runway) * ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.Runway)) + 1);
     }
 }
        IEnumerator <YieldInstruction> CheckStrategyState()
        {
            float timeStep  = 0.01f;
            float pauseTime = 0.05f;

            // Pause until the strategy system and facility systems are ready
            while (StrategySystem.Instance == null || ScenarioUpgradeableFacilities.GetFacilityLevelCount(SpaceCenterFacility.Administration) == -1)
            {
                yield return(new WaitForSeconds(5));
            }

            while (true)
            {
                float startTime = Time.realtimeSinceStartup;

                string unmetReason = "unknown";

                foreach (StrategiaStrategy strategy in StrategySystem.Instance.Strategies.OfType <StrategiaStrategy>())
                {
                    bool met = true;

                    // Check Reputation
                    if (strategy.RequiredReputation > -1000 || strategy.InitialCostReputation > 0)
                    {
                        float currentReputation = Reputation.Instance.reputation;
                        float reputationNeeded  = Math.Max(strategy.RequiredReputation,
                                                           strategy.InitialCostReputation > 0 ? strategy.InitialCostReputation : -1000);
                        met &= Math.Round(currentReputation) >= Math.Round(reputationNeeded);

                        unmetReason = "Insufficient reputation (needs " + reputationNeeded + ", has " + currentReputation + ")";
                    }

                    // Check effects
                    foreach (StrategyEffect effect in strategy.Effects)
                    {
                        if (!met)
                        {
                            break;
                        }

                        // Check if a requirement is met
                        IRequirementEffect requirement = effect as IRequirementEffect;
                        if (requirement != null)
                        {
                            met = requirement.RequirementMet(out unmetReason);
                        }

                        // Check if we need to take a break
                        if (Time.realtimeSinceStartup >= startTime + timeStep)
                        {
                            yield return(null);

                            startTime = Time.realtimeSinceStartup;
                        }
                    }

                    if (!strategyActive.ContainsKey(strategy.Config.Name))
                    {
                        strategyActive[strategy.Config.Name] = met;
                    }
                    else if (strategyActive[strategy.Config.Name] != met)
                    {
                        Notify(strategy, met);
                        strategyActive[strategy.Config.Name] = met;

                        if (!met)
                        {
                            Debug.Log("Strategia: Strategy no longer available due to reason: " + unmetReason);
                        }
                    }

                    yield return(new WaitForSeconds(pauseTime));
                }

                // Pause at least 5 seconds between full checks
                yield return(new WaitForSeconds(5));
            }
        }
Beispiel #19
0
        public int GetBuildingCosts()
        {
            int cost = 0;

            for (int i = 0; i < facilities.Count(); i++)
            {
                SpaceCenterFacility facility = facilities.ElementAt(i);
                if (facility == SpaceCenterFacility.LaunchPad || facility == SpaceCenterFacility.Runway)
                {
                    continue;
                }
                int lvl = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(facility) * ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility)) + 1;
                cost += lvl * BudgetSettings.instance.ReturnBuildingCosts(facility);
            }
            return(cost);
        }