private Experiment getExperimentByPartName(string partName) { var ExperimentParts = KEESExperimentRegister.getExperiments(); for (int idx = 0, count = ExperimentParts.Count; idx < count; idx++) { var exp = ExperimentParts[idx]; if (exp.getPartName() == partName) { return(exp); } } return(new Experiment("", "", "", "")); //Nullobject; }
/** Returns a collection of all KEES experiments which have been unlocked in the Science Centre. */ public static ReadOnlyCollection <Experiment> getUnlockedExperiments() { List <Experiment> unlockedParts = new List <Experiment>(); var ExperimentParts = KEESExperimentRegister.getExperiments(); for (int idx = 0, count = ExperimentParts.Count; idx < count; idx++) { var exp = ExperimentParts[idx]; if (NE_Helper.IsPartTechAvailable(exp.getPartName())) { unlockedParts.Add(exp); } } /* MKW: Note we cannot cache this as the user may unlock new parts in-between calls to this function. */ return(new ReadOnlyCollection <Experiment>(unlockedParts)); }
private Experiment getTargetExperiment() { var unlockedExperiments = KEESExperimentRegister.getUnlockedExperiments(); List <Experiment> unlockedNoContract = new List <Experiment>(); for (int idx = 0, count = unlockedExperiments.Count; idx < count; idx++) { var exp = unlockedExperiments[idx]; if (activeAndDoneContracts(exp.getPartName(), targetBody) == 0) { unlockedNoContract.Add(exp); } } if (unlockedNoContract.Count == 0) { return(null); } else { return(unlockedNoContract[UnityEngine.Random.Range(0, unlockedNoContract.Count)]); } }