Ejemplo n.º 1
0
        void ProcessRightStick(ulong updateTick, float deltaTime)
        {
            var x = Utility.ValueFromSides(RightStickLeft.NextRawValue, RightStickRight.NextRawValue);
            var y = Utility.ValueFromSides(RightStickDown.NextRawValue, RightStickUp.NextRawValue, InputManager.InvertYAxis);

            Vector2 v;

            if (RawSticks || RightStickLeft.Raw || RightStickRight.Raw || RightStickUp.Raw || RightStickDown.Raw)
            {
                v = new Vector2(x, y);
            }
            else
            {
                var lowerDeadZone = Utility.Max(RightStickLeft.LowerDeadZone, RightStickRight.LowerDeadZone, RightStickUp.LowerDeadZone, RightStickDown.LowerDeadZone);
                var upperDeadZone = Utility.Min(RightStickLeft.UpperDeadZone, RightStickRight.UpperDeadZone, RightStickUp.UpperDeadZone, RightStickDown.UpperDeadZone);
                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);
        }
Ejemplo n.º 2
0
 internal void CommitRightStick()
 {
     RightStickUp.Commit();
     RightStickDown.Commit();
     RightStickLeft.Commit();
     RightStickRight.Commit();
 }
Ejemplo n.º 3
0
 public void CommitRightStick()
 {
     RightStickUp.Commit();
     RightStickDown.Commit();
     RightStickLeft.Commit();
     RightStickRight.Commit();
 }
Ejemplo n.º 4
0
        internal void ProcessRightStick()
        {
            var x = Utility.ValueFromSides(RightStickLeft.NextRawValue, RightStickRight.NextRawValue);
            var y = Utility.ValueFromSides(RightStickDown.NextRawValue, RightStickUp.NextRawValue, InputManager.InvertYAxis);

            Vector2 v;

            if (RawSticks)
            {
                v = new Vector2(x, y);
            }
            else
            {
                var lowerDeadZone = Utility.Max(RightStickLeft.LowerDeadZone, RightStickRight.LowerDeadZone, RightStickUp.LowerDeadZone, RightStickDown.LowerDeadZone);
                var upperDeadZone = Utility.Min(RightStickLeft.UpperDeadZone, RightStickRight.UpperDeadZone, RightStickUp.UpperDeadZone, RightStickDown.UpperDeadZone);
                v = Utility.ApplyCircularDeadZone(x, y, lowerDeadZone, upperDeadZone);
            }

            RightStick.Raw = true;
            RightStick.UpdateWithAxes(v.X, v.Y);

            RightStickX.Raw = true;
            RightStickX.CommitWithValue(v.X);

            RightStickY.Raw = true;
            RightStickY.CommitWithValue(v.Y);

            RightStickLeft.SetValue(RightStick.Left.Value);
            RightStickRight.SetValue(RightStick.Right.Value);
            RightStickUp.SetValue(RightStick.Up.Value);
            RightStickDown.SetValue(RightStick.Down.Value);
        }
Ejemplo n.º 5
0
        internal void UpdateRightStickWithValue(Vector2 value, ulong updateTick, float deltaTime)
        {
            RightStickLeft.UpdateWithValue(Mathf.Max(0.0f, -value.x), updateTick, deltaTime);
            RightStickRight.UpdateWithValue(Mathf.Max(0.0f, value.x), updateTick, deltaTime);

            if (InputManager.InvertYAxis)
            {
                RightStickUp.UpdateWithValue(Mathf.Max(0.0f, -value.y), updateTick, deltaTime);
                RightStickDown.UpdateWithValue(Mathf.Max(0.0f, value.y), updateTick, deltaTime);
            }
            else
            {
                RightStickUp.UpdateWithValue(Mathf.Max(0.0f, value.y), updateTick, deltaTime);
                RightStickDown.UpdateWithValue(Mathf.Max(0.0f, -value.y), updateTick, deltaTime);
            }
        }
Ejemplo n.º 6
0
        internal void UpdateRightStickWithRawValue(Vector2 value)
        {
            RightStickLeft.UpdateWithRawValue(Math.Max(0.0f, -value.X));
            RightStickRight.UpdateWithRawValue(Math.Max(0.0f, value.X));

            if (InputManager.InvertYAxis)
            {
                RightStickUp.UpdateWithRawValue(Math.Max(0.0f, -value.Y));
                RightStickDown.UpdateWithRawValue(Math.Max(0.0f, value.Y));
            }
            else
            {
                RightStickUp.UpdateWithRawValue(Math.Max(0.0f, value.Y));
                RightStickDown.UpdateWithRawValue(Math.Max(0.0f, -value.Y));
            }
        }