/// <summary> /// Use to determine whether an experiment can be conducted at this time. This returns the same value as the internal check used when an experiment is deplyed from the right-click menu. /// </summary> /// <param name="isc">The science experiment module must be cast as an IScienceDataContianer.</param> /// <returns>Returns true if the experiment can be performed; will return false if the science module is not of the right type.</returns> public static bool experimentCanConduct(IScienceDataContainer isc) { if (isc == null) { return(false); } Type t = isc.GetType(); if (t == typeof(DMAnomalyScanner)) { DMAnomalyScanner DMMod = (DMAnomalyScanner)isc; return(DMMod.canConduct()); } else if (t == typeof(DMBioDrill)) { DMBioDrill DMMod = (DMBioDrill)isc; return(DMMod.canConduct()); } else if (t == typeof(DMSIGINT)) { DMSIGINT DMMod = (DMSIGINT)isc; return(DMMod.canConduct()); } else if (t == typeof(DMXRayDiffract)) { DMXRayDiffract DMMod = (DMXRayDiffract)isc; return(DMMod.canConduct()); } else if (t.IsSubclassOf(typeof(DMModuleScienceAnimate))) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)isc; return(DMMod.canConduct()); } else if (t == typeof(DMModuleScienceAnimate)) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)isc; return(DMMod.canConduct()); } else if (t == typeof(DMSeismicHammer)) { DMSeismicHammer DMMod = (DMSeismicHammer)isc; return(DMMod.canConduct()); } else if (t == typeof(DMSeismicSensor)) { DMSeismicSensor DMMod = (DMSeismicSensor)isc; return(DMMod.canConduct()); } else if (t == typeof(DMAsteroidScanner)) { DMAsteroidScanner DMMod = (DMAsteroidScanner)isc; return(DMMod.canConduct()); } return(false); }
/// <summary> /// Uses the internal method for conducting an experiment; the experiment cannot be forced and must first pass the "canConduct". All associated animations and other functions will be called. Optinally run the experiment without opening the results window. /// </summary> /// <param name="isc">The science experiment module must be cast as an IScienceDataContianer.</param> /// <param name="silent">Set to true to prevent the science results dialog from opening.</param> /// <returns>Returns true if the science module is of the right type and the gather science method is called.</returns> public static bool deployDMExperiment(IScienceDataContainer isc, bool silent = false) { if (isc == null) { return(false); } Type t = isc.GetType(); if (t == typeof(DMAnomalyScanner)) { DMAnomalyScanner DMMod = (DMAnomalyScanner)isc; DMMod.gatherScienceData(silent); return(true); } else if (t == typeof(DMBioDrill)) { DMBioDrill DMMod = (DMBioDrill)isc; DMMod.gatherScienceData(silent); return(true); } else if (t.IsSubclassOf(typeof(DMModuleScienceAnimate))) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)isc; DMMod.gatherScienceData(silent); return(true); } else if (t == typeof(DMModuleScienceAnimate)) { DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)isc; DMMod.gatherScienceData(silent); return(true); } else if (t == typeof(DMSeismicHammer)) { DMSeismicHammer DMMod = (DMSeismicHammer)isc; DMMod.gatherScienceData(silent); return(true); } else if (t == typeof(DMSeismicSensor)) { DMSeismicSensor DMMod = (DMSeismicSensor)isc; DMMod.gatherScienceData(silent); return(true); } else if (t == typeof(DMAsteroidScanner)) { DMAsteroidScanner DMMod = (DMAsteroidScanner)isc; DMMod.gatherScienceData(silent); return(true); } return(false); }
/// <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); }