Esempio n. 1
0
        void addForcesSelection()
        {
            /* add force MonoBehaviours to parts grabbed by the cursor */
            Profiler.BeginSample("[RCSBA] RCSBuildAid addForcesSelection");
            if (EditorLogic.SelectedPart == null)
            {
                Profiler.EndSample();
                return;
            }
            const bool onlyConnected = false;
            var        list          = EditorUtils.GetSelectedModulesOf <ModuleRCS>(onlyConnected);

            foreach (var pm in list)
            {
                ModuleForces.Add <RCSForce>(pm);
            }
            var moduleEngineList    = EditorUtils.GetSelectedModulesOf <ModuleEngines>(onlyConnected);
            var multiModeEngineList = EditorUtils.GetSelectedModulesOf <MultiModeEngine>(onlyConnected);

            list = sortEngineList(moduleEngineList, multiModeEngineList);
            foreach (var pm in list)
            {
                if (pm is MultiModeEngine)
                {
                    ModuleForces.Add <MultiModeEngineForce>(pm);
                }
                else if (pm is ModuleEngines)
                {
                    ModuleForces.Add <EngineForce>(pm);
                }
            }
            Profiler.EndSample();
        }
Esempio n. 2
0
        void updateSelectedModuleLists()
        {
            Profiler.BeginSample("[RCSBA] RCSBuildAid updateSelectedModuleList");
            if (EditorLogic.SelectedPart == null)
            {
                selectionList.Clear();
                hasSelectedRCS     = false;
                hasSelectedEngines = false;
                hasSelectedChutes  = false;
                Profiler.EndSample();
                return;
            }
            selectionList = new List <PartModule>();
            var list = EditorUtils.GetSelectedModulesOf <ModuleRCS>();

            hasSelectedRCS = list.Count > 0;
            selectionList.AddRange(list);
            list = EditorUtils.GetSelectedModulesOf <ModuleParachute>();
            hasSelectedChutes = list.Count > 0;
            selectionList.AddRange(list);
            var moduleEngineList    = EditorUtils.GetSelectedModulesOf <ModuleEngines> ();
            var multiModeEngineList = EditorUtils.GetSelectedModulesOf <MultiModeEngine> ();

            list = sortEngineList(moduleEngineList, multiModeEngineList);
            hasSelectedEngines = list.Count > 0;
            selectionList.AddRange(list);
            Profiler.EndSample();
        }