/// <summary> /// Calls the internal method for getting the biome for a certain experiment. /// </summary> /// <param name="mse">The science experiment module must be cast as a ModuleScienceExperiment.</param> /// <param name="sit">The current Experiment Situation value; see getExperimentSituation.</param> /// <returns>Returns the biome string for that experiment; returns an empty string if the experiment is not of the right type.</returns> public static string getBiome(ModuleScienceExperiment mse, ExperimentSituations sit) { if (mse == null) { return(""); } Type t = mse.GetType(); if (t == typeof(DMAnomalyScanner)) { DMAnomalyScanner DMMod = (DMAnomalyScanner)mse; DMMod.getAnomValues(); return(DMMod.getBiome(sit)); } else if (t == typeof(DMBathymetry)) { DMBathymetry DMMod = (DMBathymetry)mse; return(DMMod.getBiome(sit)); } else if (t == typeof(DMReconScope)) { DMReconScope DMMod = (DMReconScope)mse; return(DMMod.getBiome(sit)); } else if (t == typeof(DMSIGINT)) { DMSIGINT DMMod = (DMSIGINT)mse; return(DMMod.getBiome(sit)); } else if (t.IsSubclassOf(typeof(DMModuleScienceAnimate))) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)mse; return(DMMod.getBiome(sit)); } else if (t == typeof(DMModuleScienceAnimate)) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)mse; return(DMMod.getBiome(sit)); } return(""); }
/// <summary> /// Calls the internal method for getting the Experiment Situation for a certain experiment. /// </summary> /// <param name="mse">The science experiment module must be cast as a ModuleScienceExperiment.</param> /// <returns>Returns the Experiment Situation value for that experiment; returns InSpaceHigh if the experiment is not of the right type.</returns> public static ExperimentSituations getExperimentSituation(ModuleScienceExperiment mse) { if (mse == null) { return(ExperimentSituations.InSpaceHigh); } Type t = mse.GetType(); if (t == typeof(DMAnomalyScanner)) { DMAnomalyScanner DMMod = (DMAnomalyScanner)mse; return(DMMod.getSituation()); } else if (t == typeof(DMBathymetry)) { DMBathymetry DMMod = (DMBathymetry)mse; return(DMMod.getSituation()); } else if (t == typeof(DMReconScope)) { DMReconScope DMMod = (DMReconScope)mse; return(DMMod.getSituation()); } else if (t == typeof(DMSIGINT)) { DMSIGINT DMMod = (DMSIGINT)mse; return(DMMod.getSituation()); } else if (t.IsSubclassOf(typeof(DMModuleScienceAnimate))) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)mse; return(DMMod.getSituation()); } else if (t == typeof(DMModuleScienceAnimate)) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)mse; return(DMMod.getSituation()); } return(ExperimentSituations.InSpaceHigh); }
void RunScience() // this is primary business logic for finding and running valid experiments { if (GetExperimentList() == null) // hey, it can happen! { Debug.Log("[ForScience!] There are no experiments."); } else { foreach (ModuleScienceExperiment currentExperiment in GetExperimentList()) // loop through all the experiments onboard { if (currentExperiment.GetType() == typeof(DMModuleScienceAnimate)) { DMModuleScienceAnimate Exprimental = (DMModuleScienceAnimate)currentExperiment; Debug.Log("[ForScience!] FOUND DMModuleScienceAnimate"); Debug.Log("[ForScience! & DMModule] Running experiment: " + Exprimental.experimentID); Exprimental.gatherScienceData(true); } else if (currentExperiment.GetType() == typeof(DMBathymetry)) { DMBathymetry Exprimental = (DMBathymetry)currentExperiment; Debug.Log("[ForScience!] FOUND DMBathymetry"); Debug.Log("[ForScience! & DMModule] Running experiment: " + Exprimental.experimentID); Exprimental.gatherScienceData(true); } else if (currentExperiment.GetType() == typeof(DMReconScope)) { DMReconScope Exprimental = (DMReconScope)currentExperiment; Debug.Log("[ForScience!] FOUND DMBathymetry"); Debug.Log("[ForScience! & DMModule] Running experiment: " + Exprimental.experimentID); Exprimental.gatherScienceData(true); } else { Debug.Log("[ForScience!] Checking experiment: " + currentScienceSubject(currentExperiment.experiment).id); if (ActiveContainer().HasData(newScienceData(currentExperiment))) // skip data we already have onboard { Debug.Log("[ForScience!] Skipping: We already have that data onboard."); } else if (!surfaceSamplesUnlocked() && currentExperiment.experiment.id == "surfaceSample") // check to see is surface samples are unlocked { Debug.Log("[ForScience!] Skipping: Surface Samples are not unlocked."); } //else if (!currentExperiment.rerunnable && !IsScientistOnBoard()) // no cheating goo and materials here //{ // Debug.Log("[ForScience!] Skipping: Experiment is not repeatable."); //} else if (!currentExperiment.experiment.IsAvailableWhile(currentSituation(), currentBody())) // this experiement isn't available here so we skip it { Debug.Log("[ForScience!] Skipping: Experiment is not available for this situation/atmosphere."); } //else if (currentScienceValue(currentExperiment) < 0.1) // this experiment has no more value so we skip it //{ // Debug.Log("[ForScience!] Skipping: No more science is available: "); //} else { Debug.Log("[ForScience!] Running experiment: " + currentScienceSubject(currentExperiment.experiment).id); ActiveContainer().AddData(newScienceData(currentExperiment)); //manually add data to avoid deployexperiment state issues } } } } if (GetExperimentList2() == null) // hey, it can happen! { Debug.Log("[ForScience!] There are no DMBasicScienceModule."); } else { Debug.Log("[ForScience!] There are " + GetExperimentList2().Count + " DMBasicScienceModule."); foreach (DMBasicScienceModule DMExperiment in GetExperimentList2()) // loop through all the experiments onboard { Debug.Log("[ForScience!] Checking DMBasicScienceModule"); if (!DMExperiment.canConduct()) // this experiement isn't available here so we skip it { Debug.Log("[ForScience! & DMModule] Skipping: Experiment is not available for this situation/atmosphere."); } else { Debug.Log("[ForScience! & DMModule] Running experiment: " + DMExperiment.experimentID); DMExperiment.gatherScienceData(true); } } } }