Example #1
0
        internal void UpdateRightStickWithRawValue(Vector2 value, ulong updateTick, float deltaTime)
        {
            RightStickLeft.UpdateWithRawValue(Mathf.Max(0.0f, -value.x), updateTick, deltaTime);
            RightStickRight.UpdateWithRawValue(Mathf.Max(0.0f, value.x), updateTick, deltaTime);

            if (InputManager.InvertYAxis)
            {
                RightStickUp.UpdateWithRawValue(Mathf.Max(0.0f, -value.y), updateTick, deltaTime);
                RightStickDown.UpdateWithRawValue(Mathf.Max(0.0f, value.y), updateTick, deltaTime);
            }
            else
            {
                RightStickUp.UpdateWithRawValue(Mathf.Max(0.0f, value.y), updateTick, deltaTime);
                RightStickDown.UpdateWithRawValue(Mathf.Max(0.0f, -value.y), updateTick, deltaTime);
            }
        }
Example #2
0
        internal void ProcessRightStick(ulong updateTick, float deltaTime)
        {
            var lowerDeadZone = Utility.Max(RightStickLeft.LowerDeadZone, RightStickRight.LowerDeadZone, RightStickUp.LowerDeadZone, RightStickDown.LowerDeadZone);
            var upperDeadZone = Utility.Min(RightStickLeft.UpperDeadZone, RightStickRight.UpperDeadZone, RightStickUp.UpperDeadZone, RightStickDown.UpperDeadZone);

            var x = Utility.ValueFromSides(RightStickLeft.NextRawValue, RightStickRight.NextRawValue);
            var y = Utility.ValueFromSides(RightStickDown.NextRawValue, RightStickUp.NextRawValue, InputManager.InvertYAxis);
            var v = Utility.ApplyCircularDeadZone(x, y, lowerDeadZone, upperDeadZone);

            RightStick.Raw = true;
            RightStick.UpdateWithAxes(v.x, v.y, updateTick, deltaTime);

            RightStickX.Raw = true;
            RightStickX.CommitWithValue(v.x, updateTick, deltaTime);

            RightStickY.Raw = true;
            RightStickY.CommitWithValue(v.y, updateTick, deltaTime);

            RightStickLeft.SetValue(RightStick.Left.Value, updateTick);
            RightStickRight.SetValue(RightStick.Right.Value, updateTick);
            RightStickUp.SetValue(RightStick.Up.Value, updateTick);
            RightStickDown.SetValue(RightStick.Down.Value, updateTick);
        }