Пример #1
0
        protected void perfomBiomeAnalysys()
        {
            //We need at least one crewmember in the lab.
            if (this.part.protoModuleCrew.Count == 0)
            {
                ScreenMessages.PostScreenMessage(kNoCrew, kMessageDuration, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            //We need at least one scientist in the lab, or one TERRAIN satellite in orbit.
            float scienceBonus = getBiomeAnalysisBonus();

            //We can run the analysis, add the science bonus
            if (scienceBonus > 0.0f)
            {
                //Generate lab data
                ScienceData data = WBIBiomeAnalysis.CreateData(this.part, scienceBonus);
                scienceContainer.AddData(data);
                scienceContainer.ReviewDataItem(data);
                swizzler.SwizzleResultsDialog();
            }

            //Ok, do we at least have a TERRAIN satellite in orbit?
            else if (planetHasTerrainSat())
            {
                ScreenMessages.PostScreenMessage(kAnalysisUplink, kMessageDuration * 1.5f, ScreenMessageStyle.UPPER_CENTER);
            }

            else
            {
                ScreenMessages.PostScreenMessage(kNoScientistsOrTerrain, kMessageDuration * 1.5f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            //Run the analysis
            biomeScanner.RunAnalysis();
        }
Пример #2
0
        public override void ReviewData()
        {
            float scienceCap   = WBIBiomeAnalysis.GetScienceCap(this.part);
            float totalScience = scienceAdded;

            if (totalScience < 0.001f)
            {
                ScreenMessages.PostScreenMessage(kNoScience, 5.0f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            while (totalScience > 0.001f)
            {
                //Set the experiment title
                if (totalScience < scienceCap)
                {
                    dataAmount = totalScience;
                }
                else
                {
                    dataAmount = scienceCap;
                }

                //Generate lab data
                ScienceData data = WBIBiomeAnalysis.CreateData(this.part, dataAmount);
                scienceContainer.AddData(data);

                //Deduct from the total
                totalScience -= dataAmount;
                if (totalScience <= 0.001f)
                {
                    scienceAdded = 0f;
                }
            }

            //Make sure we have some science to transmit.
            if (scienceContainer.GetScienceCount() == 0)
            {
                ScreenMessages.PostScreenMessage(kNoScience, 5.0f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            //Review the data
            scienceContainer.ReviewData();
            swizzler.SwizzleResultsDialog();
        }