Exemplo n.º 1
0
        public static AvailablePart getPartForExperiment(string type, ExperimentData exp)
        {
            AvailablePart ap = null;

            string[] partsRegistry = null;

            switch (type)
            {
            case OMS_EXPERIMENTS:
                partsRegistry = omsRegistry;
                break;

            case KEMINI_EXPERIMENTS:
                partsRegistry = getKeminiRegister();
                break;
            }
            for (int idx = 0, count = partsRegistry.Length; idx < count; idx++)
            {
                ap = PartLoader.getPartInfoByName(partsRegistry[idx]);
                if (ap != null)
                {
                    NE_ExperimentModule e = ap.partPrefab.GetComponent <NE_ExperimentModule>();
                    if (e.type == exp.getType())
                    {
                        break;
                    }
                }
            }
            return(ap);
        }
 private static void addParts(List <string> partNames, List <ExperimentData> list)
 {
     foreach (string pn in partNames)
     {
         AvailablePart part = PartLoader.getPartInfoByName(pn);
         if (part != null)
         {
             if (ResearchAndDevelopment.PartTechAvailable(part))
             {
                 Part pPf = part.partPrefab;
                 NE_ExperimentModule exp = pPf.GetComponent <NE_ExperimentModule>();
                 float mass = pPf.mass;
                 list.Add(getExperiment(exp.type, mass));
             }
         }
     }
 }
Exemplo n.º 3
0
        /** Returns a list of all purchased experiments.
         * If includeExperimental is true, it includes unpurchased parts as long as the required tech is available. */
        public static List <ExperimentData> getAvailableExperiments(string type, bool includeExperimental = false)
        {
            List <ExperimentData> list  = new List <ExperimentData>();
            List <AvailablePart>  parts = getAvailableExperimentParts(type, includeExperimental);

            for (int idx = 0, count = parts.Count; idx < count; idx++)
            {
                var  part = parts[idx];
                Part pPf  = part.partPrefab;
                NE_ExperimentModule exp = pPf.GetComponent <NE_ExperimentModule>();
                float mass = pPf.mass;  //pPf.GetModuleMass(0);
                float cost = part.cost; //pPf.GetModuleCosts(0);
                list.Add(getExperiment(exp.type, mass, cost));
            }

            return(list);
        }