Beispiel #1
0
        private void SneezeRecover()
        {
            movementState.Velocity = Vector2.zero;

            playerState        = Player.PlayerState.Idle;
            sneezeDashSettings = DashSettings.Default;
            fireAction?.Enable();
            aimAction?.Enable();
        }
Beispiel #2
0
    private void OnEnable()
    {
        m_keyboardAction?.Enable();
        m_mouseAction?.Enable();

        StartCoroutine(nameof(EnableTrackKeyboardInput));
    }
Beispiel #3
0
 void OnEnable()
 {
     m_touchAction?.Enable();
 }
Beispiel #4
0
 //------------------------------------------------------------------------------------------------------
 //
 //------------------------------------------------------------------------------------------------------
 private void OnEnable()
 {
     action.Enable();
     jumpAction.Enable();
     runAction.Enable();
 }
Beispiel #5
0
 private void OnEnable()
 {
     moveInput.Enable();
     dashInput.Enable();
 }
Beispiel #6
0
 void NextButtonActivate()
 {
     _nextInputAction.Enable();
     _skipInputAction.Enable();
 }
Beispiel #7
0
 private void OnEnable()
 {
     movement.Enable();
 }
Beispiel #8
0
        /// <summary>
        /// Author: Denis
        /// Subscribing to the controller events and adding this modifier to the movement modifiers list
        /// </summary>
        private void OnEnable()
        {
            MoveAction.Enable();

            PlayerMovementHandler.AddModifier(this);
        }
Beispiel #9
0
 //InputActions
 //Activates all actions in Player action maps (action maps are Player and UI)
 private void OnEnable()
 {
     menuAction.Enable();
     cancel.Enable();
     _inputAction.UI.Enable();
 }
Beispiel #10
0
 protected override void Awake()
 {
     base.Awake();
     mute.Enable();
 }
Beispiel #11
0
 private void OnEnable()
 {
     join.Enable();
     back.Enable();
 }
Beispiel #12
0
 private void OnEnable()
 {
     launchAction.Enable();
 }
 //InputActions
 //Activates all actions in Player action maps (action maps are Player and UI)
 private void OnEnable()
 {
     mapAction.Enable();
     _inputAction.Player.Enable();
 }
 public void OnEnable()
 {
     //
     //
     m_inputActionJump.Enable();
 }
 // Use this for initialization
 void Start()
 {
     touch_action            = new InputAction(name: "TouchAction", binding: "<touchscreen>/<touch>");
     touch_action.performed += callbackContext => TouchInput(callbackContext.control as TouchControl);
     touch_action.Enable();
 }
Beispiel #16
0
 private void OnEnable()
 {
     movement.Enable();
     turning.Enable();
 }
 void OnEnable()
 {
     _action.performed += OnPerformed;
     _action.Enable();
 }
Beispiel #18
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
        }
 void OnEnable()
 {
     botaoAtaque.Enable();
     botoesDirecionais.Enable();
 }
 private void OnEnable()
 {
     movePlayer.Enable();
     jump.Enable();
 }
Beispiel #21
0
 private void OnEnable()
 {
     backInput.Enable();
 }
Beispiel #22
0
 private void OnEnable()
 {
     m_inputAction.Enable();
 }
Beispiel #23
0
 private void OnEnable()
 {
     inputOpenTutorialPanel.Enable();
     inputCloseTutorialPanel.Enable();
 }
Beispiel #24
0
 private void OnEnable()
 {
     jumpInput.Enable();
     moveInput.Enable();
 }
Beispiel #25
0
 void OnEnable()
 {
     m_penButtonAction?.Enable();
     m_penVector2Action?.Enable();
     m_penAxisAction?.Enable();
 }
 private void OnEnable()
 {
     toggleAction.Enable();
     resetSceneAction.Enable();
 }
Beispiel #27
0
 private void Awake()
 {
     pauseAction = pauseActionReference.action.Clone();
     pauseAction.Enable();
 }
Beispiel #28
0
 private void OnEnable()
 {
     MoveAction.Enable();
 }
Beispiel #29
0
    public void Actions_CanReactToGamePadAxisChanges()
    {
        var device = InputSystem.AddDevice(new InputDeviceDescription
        {
            interfaceName = "Android",
            deviceClass   = "AndroidGameController",
            capabilities  = new AndroidDeviceCapabilities
            {
                inputSources = AndroidInputSource.Gamepad | AndroidInputSource.Joystick,
            }.ToJson()
        });

        var controller = (AndroidGamepad)device;

        var leftStick  = new Vector2(0.3f, 0.3f);
        var rightStick = new Vector2(0.35f, 0.35f);

        var updateSticks = new Action(() =>
        {
            InputSystem.QueueStateEvent(controller,
                                        new AndroidGameControllerState()
                                        .WithAxis(AndroidAxis.X, leftStick.x)
                                        .WithAxis(AndroidAxis.Y, leftStick.y)
                                        .WithAxis(AndroidAxis.Z, rightStick.x)
                                        .WithAxis(AndroidAxis.Rz, rightStick.y));
        });

        var processStickValue = new Func <Vector2, Vector2>(v =>
        {
            v.y = -v.y;
            return(new StickDeadzoneProcessor().Process(v));
        });


        updateSticks();
        InputSystem.Update();
        InputSystem.Update();

        var leftStickAction  = new InputAction(binding: "/<Gamepad>/leftStick");
        var rightStickAction = new InputAction(binding: "/<Gamepad>/rightStick");

        var leftStickActionPerformed  = 0;
        var rightStickActionPerformed = 0;
        var receivedLeftStick         = Vector2.zero;
        var receivedRightStick        = Vector2.zero;

        leftStickAction.performed += ctx =>
        {
            receivedLeftStick = ctx.ReadValue <Vector2>();
            ++leftStickActionPerformed;
        };

        rightStickAction.performed += ctx =>
        {
            receivedRightStick = ctx.ReadValue <Vector2>();
            ++rightStickActionPerformed;
        };

        leftStickAction.Enable();
        rightStickAction.Enable();

        // Actions are called the first time they're enabled?
        InputSystem.Update();
        Assert.That(leftStickActionPerformed, Is.EqualTo(1));
        Assert.That(rightStickActionPerformed, Is.EqualTo(1));

        // Update only left stick's X value
        leftStick.x += 0.1f;
        updateSticks();
        InputSystem.Update();
        Assert.That(leftStickActionPerformed, Is.EqualTo(2));
        Assert.That(rightStickActionPerformed, Is.EqualTo(1));
        Assert.That(controller.leftStick.ReadValue(), Is.EqualTo(processStickValue(leftStick)).Using(Vector2EqualityComparer.Instance));
        Assert.That(controller.rightStick.ReadValue(), Is.EqualTo(processStickValue(rightStick)).Using(Vector2EqualityComparer.Instance));

        // Update only left stick's Y value
        leftStick.y += 0.1f;
        updateSticks();
        InputSystem.Update();
        Assert.That(leftStickActionPerformed, Is.EqualTo(3));
        Assert.That(rightStickActionPerformed, Is.EqualTo(1));
        Assert.That(controller.leftStick.ReadValue(), Is.EqualTo(processStickValue(leftStick)).Using(Vector2EqualityComparer.Instance));
        Assert.That(controller.rightStick.ReadValue(), Is.EqualTo(processStickValue(rightStick)).Using(Vector2EqualityComparer.Instance));

        // Update only right stick's X value
        rightStick.x += 0.1f;
        updateSticks();
        InputSystem.Update();
        Assert.That(leftStickActionPerformed, Is.EqualTo(3));
        Assert.That(rightStickActionPerformed, Is.EqualTo(2));
        Assert.That(controller.leftStick.ReadValue(), Is.EqualTo(processStickValue(leftStick)).Using(Vector2EqualityComparer.Instance));
        Assert.That(controller.rightStick.ReadValue(), Is.EqualTo(processStickValue(rightStick)).Using(Vector2EqualityComparer.Instance));

        // Update only right stick's Y value
        rightStick.y += 0.1f;
        updateSticks();
        InputSystem.Update();
        Assert.That(leftStickActionPerformed, Is.EqualTo(3));
        Assert.That(rightStickActionPerformed, Is.EqualTo(3));
        Assert.That(controller.leftStick.ReadValue(), Is.EqualTo(processStickValue(leftStick)).Using(Vector2EqualityComparer.Instance));
        Assert.That(controller.rightStick.ReadValue(), Is.EqualTo(processStickValue(rightStick)).Using(Vector2EqualityComparer.Instance));
    }
Beispiel #30
0
    public void Users_CanDetectWhenUnassignedDeviceIsUsed()
    {
        var gamepad1 = InputSystem.AddDevice <Gamepad>();
        var gamepad2 = InputSystem.AddDevice <Gamepad>();
        var gamepad3 = InputSystem.AddDevice <Gamepad>();

        var asset = ScriptableObject.CreateInstance <InputActionAsset>();
        var map   = new InputActionMap("map");

        asset.AddActionMap(map);

        var actionAssignedToUser = map.AddAction("action", binding: "<Gamepad>/buttonSouth");

        actionAssignedToUser.Enable();

        var actionNotAssignedToUser = new InputAction(binding: "<Gamepad>/buttonNorth");

        actionNotAssignedToUser.Enable();

        var user = new TestUser();

        InputUser.Add(user);

        // Noise.
        InputUser.Add(new TestUser());
        InputUser.all[1].AssignInputDevice(gamepad3);

        IInputUser   receivedUser    = null;
        InputAction  receivedAction  = null;
        InputControl receivedControl = null;

        InputUser.onUnassignedDeviceUsed +=
            (u, a, c) =>
        {
            Assert.That(receivedUser, Is.Null);
            receivedUser    = u;
            receivedAction  = a;
            receivedControl = c;
        };

        user.AssignInputActions(asset);
        user.AssignInputDevice(gamepad1);

        // No callback if using gamepad1.
        InputSystem.QueueStateEvent(gamepad1, new GamepadState().WithButton(GamepadButton.South));
        InputSystem.Update();

        Assert.That(receivedUser, Is.Null);
        Assert.That(receivedAction, Is.Null);
        Assert.That(receivedControl, Is.Null);

        // Callback when using gamepad2.
        InputSystem.QueueStateEvent(gamepad2, new GamepadState().WithButton(GamepadButton.South));
        InputSystem.Update();

        Assert.That(receivedUser, Is.SameAs(user));
        Assert.That(receivedAction, Is.SameAs(actionAssignedToUser));
        Assert.That(receivedControl, Is.SameAs(gamepad2.buttonSouth));

        receivedUser    = null;
        receivedControl = null;
        receivedAction  = null;

        // No callback when triggering action not assigned to user.
        InputSystem.QueueStateEvent(gamepad1, new GamepadState().WithButton(GamepadButton.North));
        InputSystem.Update();

        Assert.That(receivedUser, Is.Null);
        Assert.That(receivedAction, Is.Null);
        Assert.That(receivedControl, Is.Null);
    }