Beispiel #1
0
        public void                         CheckAdvancedResearch()
        {
            if (
                (!DebugSettings.godMode) &&
                (wasGodMode)
                )
            {
                // Reset everything
                SetInitialState();
                wasGodMode = false;
            }

            // Prepare for some work
            PrepareCaches();

            // Scan advanced research for newly completed projects
            foreach (var Advanced in Data.AdvancedResearchDefs)
            {
                if (Advanced.ResearchState != ResearchEnableMode.Complete)
                {
                    var enableMode = Advanced.EnableMode;
                    if (enableMode != Advanced.ResearchState)
                    {
                        // Enable this project
                        Advanced.Enable(enableMode);
                    }
                }
            }

            // Process caches
            ProcessCaches();
        }
        void                                CheckAdvancedResearch()
        {
            if (!Game.GodMode)
            {
                // Quick scan to see if anything changed and early out if nothing new is complete

                if (wasGodMode)
                {
                    // Reset everything
                    SetInitialState();
                    wasGodMode = false;
                }

                // God mode is off, do a real check
                bool Changed = false;
                for (int i = 0; i < researchCache.Count; i++)
                {
                    var rcPair = researchCache[i];
                    if ((rcPair.researchProject.IsFinished) && (!rcPair.wasComplete))
                    {
                        rcPair.wasComplete = true;
                        Changed            = true;
                    }
                }

                if (!Changed)
                {
                    // No new research complete
                    return;
                }
            }

            // Prepare for some work
            PrepareCaches();

            // Scan advanced research for newly completed projects
            foreach (var Advanced in AdvancedResearch)
            {
                if (Advanced.CanEnable)
                {
                    // Enable this project
                    Advanced.Enable();
                }
            }

            // Process caches
            ProcessCaches();
        }