예제 #1
0
        public static void Init()
        {
            if (initialized) {
                return;
            }
            initialized = true;

            keyBindings = new KeyBindings<BoundKey>();

            keyBindings.AddBinding(BoundKey.KEY_TOGGLE_WINDOW,
                new KeyBind("toggle KerbCam window", true, KeyCode.F8));

            // Playback controls.
            keyBindings.AddBinding(BoundKey.KEY_PATH_TOGGLE_RUNNING,
                new KeyBind("play/stop selected path", false, KeyCode.Insert));
            keyBindings.AddBinding(BoundKey.KEY_PATH_TOGGLE_PAUSE,
                new KeyBind("pause selected path", false, KeyCode.Home));

            // Manual camera control keys.
            keyBindings.AddBinding(BoundKey.KEY_TRN_UP, new KeyBind("translate up"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_FORWARD, new KeyBind("translate forward"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_LEFT, new KeyBind("translate left"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_RIGHT, new KeyBind("translate right"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_DOWN, new KeyBind("translate down"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_BACKWARD, new KeyBind("translate backward"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_ROLL_LEFT, new KeyBind("roll left"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_UP, new KeyBind("pan up"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_ROLL_RIGHT, new KeyBind("roll right"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_LEFT, new KeyBind("pan left"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_RIGHT, new KeyBind("pan right"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_DOWN, new KeyBind("pan down"));

            keyBindings.AddBinding(BoundKey.KEY_DEBUG,
                new KeyBind("log debug data (developer mode only)"));

            paths = new List<SimpleCamPath>();
            camControlObj = new GameObject("KerbCam.CameraController");
            UnityEngine.Object.DontDestroyOnLoad(camControlObj);
            camControl = camControlObj.AddComponent<CameraController>();
            manCamControl = ManualCameraControl.Create();
            mainWindow = new MainWindow();
        }
예제 #2
0
        static StateHandler()
        {
            keyBindings = new KeyBindings <BoundKey>();

            keyBindings.AddBinding(BoundKey.KEY_TOGGLE_WINDOW,
                                   new KeyBind("toggle KerbCam window",
                                               // Binding required if Toolbar isn't available.
                                               /*!ToolbarManager.ToolbarAvailable*/ true,
                                               KeyCode.F8));

            // Playback controls.
            keyBindings.AddBinding(BoundKey.KEY_PATH_TOGGLE_RUNNING,
                                   new KeyBind("play/stop selected path", false, KeyCode.Insert));
            keyBindings.AddBinding(BoundKey.KEY_PATH_TOGGLE_PAUSE,
                                   new KeyBind("pause selected path", false, KeyCode.Home));

            // Manual camera control keys.
            keyBindings.AddBinding(BoundKey.KEY_TRN_UP, new KeyBind("translate up"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_FORWARD, new KeyBind("translate forward"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_LEFT, new KeyBind("translate left"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_RIGHT, new KeyBind("translate right"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_DOWN, new KeyBind("translate down"));
            keyBindings.AddBinding(BoundKey.KEY_TRN_BACKWARD, new KeyBind("translate backward"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_ROLL_LEFT, new KeyBind("roll left"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_UP, new KeyBind("pan up"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_ROLL_RIGHT, new KeyBind("roll right"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_LEFT, new KeyBind("pan left"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_RIGHT, new KeyBind("pan right"));
            keyBindings.AddBinding(BoundKey.KEY_ROT_DOWN, new KeyBind("pan down"));

            keyBindings.AddBinding(BoundKey.KEY_DEBUG, new KeyBind("log debug data (developer mode only)"));
            keyBindings.ListenKeyUp(BoundKey.KEY_DEBUG, HandleDebug);

            paths         = new List <SimpleCamPath>();
            camControlObj = new GameObject("KerbCam.CameraController");
            UnityEngine.Object.DontDestroyOnLoad(camControlObj);
            camControl    = camControlObj.AddComponent <CameraController>();
            manCamControl = ManualCameraControl.Create();

            LoadConfig();
            LoadPaths();
        }