コード例 #1
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);
                    }
                }
            }
        }