Exemple #1
0
        void RegisterInputs()
        {
#if UNITY_EDITOR
            List <InputManagerEntry> inputEntries = new List <InputManagerEntry>();

            // Add new bindings
            inputEntries.Add(new InputManagerEntry {
                name = kRightStickX, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fourth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f
            });
            inputEntries.Add(new InputManagerEntry {
                name = kRightStickY, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fifth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f, invert = true
            });

            inputEntries.Add(new InputManagerEntry {
                name = kYAxis, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "page up", altBtnPositive = "joystick button 5", btnNegative = "page down", altBtnNegative = "joystick button 4", gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f
            });

            inputEntries.Add(new InputManagerEntry {
                name = kSpeedAxis, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "home", btnNegative = "end", gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f
            });
            inputEntries.Add(new InputManagerEntry {
                name = kSpeedAxis, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Seventh, gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f
            });

            InputRegistering.RegisterInputs(inputEntries);
#endif
        }
Exemple #2
0
        public void RegisterInputs()
        {
#if UNITY_EDITOR
            var inputEntries = new List <InputManagerEntry> {
                new InputManagerEntry {
                    name = "Left Menu", kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "joystick button 2"
                },
                new InputManagerEntry {
                    name = "Right Menu", kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "joystick button 0"
                },
                new InputManagerEntry {
                    name = "Left Pad Press", kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "joystick button 8"
                },
                new InputManagerEntry {
                    name = "Right Pad Press", kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "joystick button 9"
                },
                new InputManagerEntry {
                    name = "Left Pad Touch", kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "joystick button 16"
                },
                new InputManagerEntry {
                    name = "Right Pad Touch", kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "joystick button 17"
                },
                new InputManagerEntry {
                    name = "Left Horizontal", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.X, deadZone = 0.001f, sensitivity = 1f
                },
                new InputManagerEntry {
                    name = "Left Vertical", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Y, deadZone = 0.001f, sensitivity = 1f, invert = true
                },
                new InputManagerEntry {
                    name = "Right Horizontal", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fourth, deadZone = 0.001f, sensitivity = 1f
                },
                new InputManagerEntry {
                    name = "Right Vertical", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fifth, deadZone = 0.001f, sensitivity = 1f, invert = true
                },
                new InputManagerEntry {
                    name = "Left Trigger", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.X + 8, deadZone = 0.001f, sensitivity = 1f
                },
                new InputManagerEntry {
                    name = "Right Trigger", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.X + 9, deadZone = 0.001f, sensitivity = 1f
                },
                new InputManagerEntry {
                    name = "Left Grip", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.X + 10, deadZone = 0.001f, sensitivity = 1f, snap = true
                },
                new InputManagerEntry {
                    name = "Right Grip", kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.X + 11, deadZone = 0.001f, sensitivity = 1f, snap = true
                },
            };
            InputRegistering.RegisterInputs(inputEntries);
#endif
        }
Exemple #3
0
        void RegisterInputs()
        {
#if UNITY_EDITOR
            List <InputManagerEntry> inputEntries = new List <InputManagerEntry>();

            // Add new bindings
            inputEntries.Add(new InputManagerEntry {
                name = kRightStickX, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fourth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f
            });
            inputEntries.Add(new InputManagerEntry {
                name = kRightStickY, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fifth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f, invert = true
            });

            InputRegistering.RegisterInputs(inputEntries);
#endif
        }
        void RegisterInputs()
        {
#if UNITY_EDITOR
            var inputEntries = new List <InputManagerEntry>
            {
                new InputManagerEntry {
                    name = kEnableDebugBtn1, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "left ctrl", altBtnPositive = "joystick button 8"
                },
                new InputManagerEntry {
                    name = kEnableDebugBtn2, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "backspace", altBtnPositive = "joystick button 9"
                },
                new InputManagerEntry {
                    name = kResetBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "left alt", altBtnPositive = "joystick button 1"
                },
                new InputManagerEntry {
                    name = kDebugNextBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "page down", altBtnPositive = "joystick button 5"
                },
                new InputManagerEntry {
                    name = kDebugPreviousBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "page up", altBtnPositive = "joystick button 4"
                },
                new InputManagerEntry {
                    name = kValidateBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "return", altBtnPositive = "joystick button 0"
                },
                new InputManagerEntry {
                    name = kPersistentBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "right shift", altBtnPositive = "joystick button 2"
                },
                new InputManagerEntry {
                    name = kMultiplierBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "left shift", altBtnPositive = "joystick button 3"
                },
                new InputManagerEntry {
                    name = kDPadHorizontal, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "right", btnNegative = "left", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
                new InputManagerEntry {
                    name = kDPadVertical, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "up", btnNegative = "down", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
                new InputManagerEntry {
                    name = kDPadVertical, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Seventh, btnPositive = "up", btnNegative = "down", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
                new InputManagerEntry {
                    name = kDPadHorizontal, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Sixth, btnPositive = "right", btnNegative = "left", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
            };

            InputRegistering.RegisterInputs(inputEntries);
#endif
        }
Exemple #5
0
        void RegisterInputs()
        {
#if USE_INPUT_SYSTEM
            var map = new InputActionMap("Free Camera");

            lookAction  = map.AddAction("look", binding: "<Mouse>/delta");
            moveAction  = map.AddAction("move", binding: "<Gamepad>/leftStick");
            speedAction = map.AddAction("speed", binding: "<Gamepad>/dpad");
            yMoveAction = map.AddAction("yMove");

            lookAction.AddBinding("<Gamepad>/rightStick").WithProcessor("scaleVector2(x=15, y=15)");
            moveAction.AddCompositeBinding("Dpad")
            .With("Up", "<Keyboard>/w")
            .With("Up", "<Keyboard>/upArrow")
            .With("Down", "<Keyboard>/s")
            .With("Down", "<Keyboard>/downArrow")
            .With("Left", "<Keyboard>/a")
            .With("Left", "<Keyboard>/leftArrow")
            .With("Right", "<Keyboard>/d")
            .With("Right", "<Keyboard>/rightArrow");
            speedAction.AddCompositeBinding("Dpad")
            .With("Up", "<Keyboard>/home")
            .With("Down", "<Keyboard>/end");
            yMoveAction.AddCompositeBinding("Dpad")
            .With("Up", "<Keyboard>/pageUp")
            .With("Down", "<Keyboard>/pageDown")
            .With("Up", "<Keyboard>/e")
            .With("Down", "<Keyboard>/q")
            .With("Up", "<Gamepad>/rightshoulder")
            .With("Down", "<Gamepad>/leftshoulder");

            moveAction.Enable();
            lookAction.Enable();
            speedAction.Enable();
            fireAction.Enable();
            yMoveAction.Enable();
#endif

#if UNITY_EDITOR && !USE_INPUT_SYSTEM
            List <InputManagerEntry> inputEntries = new List <InputManagerEntry>();

            // Add new bindings
            inputEntries.Add(new InputManagerEntry {
                name = kRightStickX, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fourth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f
            });
            inputEntries.Add(new InputManagerEntry {
                name = kRightStickY, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fifth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f, invert = true
            });

            inputEntries.Add(new InputManagerEntry {
                name = kYAxis, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "page up", altBtnPositive = "joystick button 5", btnNegative = "page down", altBtnNegative = "joystick button 4", gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f
            });
            inputEntries.Add(new InputManagerEntry {
                name = kYAxis, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "q", btnNegative = "e", gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f
            });

            inputEntries.Add(new InputManagerEntry {
                name = kSpeedAxis, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "home", btnNegative = "end", gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f
            });
            inputEntries.Add(new InputManagerEntry {
                name = kSpeedAxis, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Seventh, gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f
            });

            InputRegistering.RegisterInputs(inputEntries);
#endif
        }
Exemple #6
0
        void RegisterInputs()
        {
#if UNITY_EDITOR && !USE_INPUT_SYSTEM
            var inputEntries = new List <InputManagerEntry>
            {
                new InputManagerEntry {
                    name = kEnableDebugBtn1, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "left ctrl", altBtnPositive = "joystick button 8"
                },
                new InputManagerEntry {
                    name = kEnableDebugBtn2, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "backspace", altBtnPositive = "joystick button 9"
                },
                new InputManagerEntry {
                    name = kResetBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "left alt", altBtnPositive = "joystick button 1"
                },
                new InputManagerEntry {
                    name = kDebugNextBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "page down", altBtnPositive = "joystick button 5"
                },
                new InputManagerEntry {
                    name = kDebugPreviousBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "page up", altBtnPositive = "joystick button 4"
                },
                new InputManagerEntry {
                    name = kValidateBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "return", altBtnPositive = "joystick button 0"
                },
                new InputManagerEntry {
                    name = kPersistentBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "right shift", altBtnPositive = "joystick button 2"
                },
                new InputManagerEntry {
                    name = kMultiplierBtn, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "left shift", altBtnPositive = "joystick button 3"
                },
                new InputManagerEntry {
                    name = kDPadHorizontal, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "right", btnNegative = "left", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
                new InputManagerEntry {
                    name = kDPadVertical, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "up", btnNegative = "down", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
                new InputManagerEntry {
                    name = kDPadVertical, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Seventh, btnPositive = "up", btnNegative = "down", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
                new InputManagerEntry {
                    name = kDPadHorizontal, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Sixth, btnPositive = "right", btnNegative = "left", gravity = 1000f, deadZone = 0.001f, sensitivity = 1000f
                },
            };

            InputRegistering.RegisterInputs(inputEntries);
#endif

#if USE_INPUT_SYSTEM
            // Register input system actions
            var enableAction = debugActionMap.AddAction(kEnableDebug, type: InputActionType.Button);
            enableAction.AddCompositeBinding("ButtonWithOneModifier")
            .With("Modifier", "<Gamepad>/rightStickPress")
            .With("Button", "<Gamepad>/leftStickPress")
            .With("Modifier", "<Keyboard>/leftCtrl")
            .With("Button", "<Keyboard>/backspace");

            var resetAction = debugActionMap.AddAction(kResetBtn, type: InputActionType.Button);
            resetAction.AddCompositeBinding("ButtonWithOneModifier")
            .With("Modifier", "<Gamepad>/rightStickPress")
            .With("Button", "<Gamepad>/b")
            .With("Modifier", "<Keyboard>/leftAlt")
            .With("Button", "<Keyboard>/backspace");

            var next = debugActionMap.AddAction(kDebugNextBtn, type: InputActionType.Button);
            next.AddBinding("<Keyboard>/pageDown");
            next.AddBinding("<Gamepad>/rightShoulder");

            var previous = debugActionMap.AddAction(kDebugPreviousBtn, type: InputActionType.Button);
            previous.AddBinding("<Keyboard>/pageUp");
            previous.AddBinding("<Gamepad>/leftShoulder");

            var validateAction = debugActionMap.AddAction(kValidateBtn, type: InputActionType.Button);
            validateAction.AddBinding("<Keyboard>/enter");
            validateAction.AddBinding("<Gamepad>/a");

            var persistentAction = debugActionMap.AddAction(kPersistentBtn, type: InputActionType.Button);
            persistentAction.AddBinding("<Keyboard>/rightShift");
            persistentAction.AddBinding("<Gamepad>/x");

            var multiplierAction = debugActionMap.AddAction(kMultiplierBtn, type: InputActionType.Value);
            multiplierAction.AddBinding("<Keyboard>/leftShift");
            multiplierAction.AddBinding("<Gamepad>/y");

            var moveVerticalAction = debugActionMap.AddAction(kDPadVertical);
            moveVerticalAction.AddCompositeBinding("1DAxis")
            .With("Positive", "<Gamepad>/dpad/up")
            .With("Negative", "<Gamepad>/dpad/down")
            .With("Positive", "<Keyboard>/upArrow")
            .With("Negative", "<Keyboard>/downArrow");

            var moveHorizontalAction = debugActionMap.AddAction(kDPadHorizontal);
            moveHorizontalAction.AddCompositeBinding("1DAxis")
            .With("Positive", "<Gamepad>/dpad/right")
            .With("Negative", "<Gamepad>/dpad/left")
            .With("Positive", "<Keyboard>/rightArrow")
            .With("Negative", "<Keyboard>/leftArrow");
#endif
        }