Beispiel #1
0
        void Update()
        {
            Profiler.BeginSample("[RCSBA] RCSBuildAid Update");
            if (PluginKeys.PLUGIN_TOGGLE.GetKeyDown() && !EditorUtils.isInputFieldFocused())
            {
                SetActive(!Enabled);
            }

            if (Enabled)
            {
                /* Switching direction */
                if (Input.anyKeyDown && !EditorUtils.isInputFieldFocused())
                {
                    if (PluginKeys.TRANSLATE_UP.GetKey())
                    {
                        switchDirection(Direction.up);
                    }
                    else if (PluginKeys.TRANSLATE_DOWN.GetKey())
                    {
                        switchDirection(Direction.down);
                    }
                    else if (PluginKeys.TRANSLATE_FWD.GetKeyDown())
                    {
                        switchDirection(Direction.forward);
                    }
                    else if (PluginKeys.TRANSLATE_BACK.GetKeyDown())
                    {
                        switchDirection(Direction.back);
                    }
                    else if (PluginKeys.TRANSLATE_LEFT.GetKeyDown())
                    {
                        switchDirection(Direction.left);
                    }
                    else if (PluginKeys.TRANSLATE_RIGHT.GetKeyDown())
                    {
                        switchDirection(Direction.right);
                    }
                }
            }
            Profiler.EndSample();
        }
Beispiel #2
0
        void Update()
        {
            bool disableShortcuts = EditorUtils.isInputFieldFocused();

            if (!disableShortcuts && PluginKeys.PLUGIN_TOGGLE.GetKeyDown())
            {
                SetActive(!Enabled);
            }

            if (Enabled)
            {
                bool b = (Mode == PluginMode.Parachutes);
                if (CoD.activeInHierarchy != b)
                {
                    CoD.SetActive(b);
                }
            }
            else if (CoD.activeInHierarchy)
            {
                CoD.SetActive(false);
            }

            if (Enabled)
            {
                updateModuleLists();
                addForces();
                //EditorUtils.RunOnAllParts (addDragVectors);

                /* find the bottommost stage with engines */
                int stage = 0;
                foreach (PartModule mod in engineList)
                {
                    if (mod.part.inverseStage > stage)
                    {
                        stage = mod.part.inverseStage;
                    }
                }
                LastStage = stage;

                /* Switching direction */
                if (!disableShortcuts && Input.anyKeyDown)
                {
                    if (ExtendedInput.GetKey(PluginKeys.TRANSLATE_UP))
                    {
                        switchDirection(Direction.up);
                    }
                    else if (ExtendedInput.GetKey(PluginKeys.TRANSLATE_DOWN))
                    {
                        switchDirection(Direction.down);
                    }
                    else if (ExtendedInput.GetKey(PluginKeys.TRANSLATE_FWD))
                    {
                        switchDirection(Direction.forward);
                    }
                    else if (ExtendedInput.GetKey(PluginKeys.TRANSLATE_BACK))
                    {
                        switchDirection(Direction.back);
                    }
                    else if (ExtendedInput.GetKey(PluginKeys.TRANSLATE_LEFT))
                    {
                        switchDirection(Direction.left);
                    }
                    else if (ExtendedInput.GetKey(PluginKeys.TRANSLATE_RIGHT))
                    {
                        switchDirection(Direction.right);
                    }
                }
            }
        }