Example #1
0
 internal void CommitLeftStick()
 {
     LeftStickUp.Commit();
     LeftStickDown.Commit();
     LeftStickLeft.Commit();
     LeftStickRight.Commit();
 }
Example #2
0
        internal void ProcessLeftStick(ulong updateTick, float deltaTime)
        {
            var x = Utility.ValueFromSides(LeftStickLeft.NextRawValue, LeftStickRight.NextRawValue);
            var y = Utility.ValueFromSides(LeftStickDown.NextRawValue, LeftStickUp.NextRawValue, InputManager.InvertYAxis);

            Vector2 v;

            if (RawSticks)
            {
                v = new Vector2(x, y);
            }
            else
            {
                var lowerDeadZone = Utility.Max(LeftStickLeft.LowerDeadZone, LeftStickRight.LowerDeadZone, LeftStickUp.LowerDeadZone, LeftStickDown.LowerDeadZone);
                var upperDeadZone = Utility.Min(LeftStickLeft.UpperDeadZone, LeftStickRight.UpperDeadZone, LeftStickUp.UpperDeadZone, LeftStickDown.UpperDeadZone);
                v = Utility.ApplyCircularDeadZone(x, y, lowerDeadZone, upperDeadZone);
            }

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

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

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

            LeftStickLeft.SetValue(LeftStick.Left.Value, updateTick);
            LeftStickRight.SetValue(LeftStick.Right.Value, updateTick);
            LeftStickUp.SetValue(LeftStick.Up.Value, updateTick);
            LeftStickDown.SetValue(LeftStick.Down.Value, updateTick);
        }
Example #3
0
    void ProcessLeftStick(ulong updateTick, float deltaTime)
    {
        var x = Utility.ValueFromSides(LeftStickLeft.NextRawValue, LeftStickRight.NextRawValue);
        var y = Utility.ValueFromSides(LeftStickDown.NextRawValue, LeftStickUp.NextRawValue, InputManager.InvertYAxis);

        Vector2 v;

        //if (RawSticks)
        //{
        v = new Vector2(x, y);
        //}


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

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

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

        LeftStickLeft.SetValue(LeftStick.Left.Value, updateTick);
        LeftStickRight.SetValue(LeftStick.Right.Value, updateTick);
        LeftStickUp.SetValue(LeftStick.Up.Value, updateTick);
        LeftStickDown.SetValue(LeftStick.Down.Value, updateTick);
    }
Example #4
0
        internal void UpdateLeftStickWithValue(Vector2 value, ulong updateTick, float deltaTime)
        {
            LeftStickLeft.UpdateWithValue(Mathf.Max(0.0f, -value.x), updateTick, deltaTime);
            LeftStickRight.UpdateWithValue(Mathf.Max(0.0f, value.x), updateTick, deltaTime);

            if (InputManager.InvertYAxis)
            {
                LeftStickUp.UpdateWithValue(Mathf.Max(0.0f, -value.y), updateTick, deltaTime);
                LeftStickDown.UpdateWithValue(Mathf.Max(0.0f, value.y), updateTick, deltaTime);
            }
            else
            {
                LeftStickUp.UpdateWithValue(Mathf.Max(0.0f, value.y), updateTick, deltaTime);
                LeftStickDown.UpdateWithValue(Mathf.Max(0.0f, -value.y), updateTick, deltaTime);
            }
        }
Example #5
0
        internal void UpdateLeftStickWithRawValue(Vector2 value)
        {
            LeftStickLeft.UpdateWithRawValue(Math.Max(0.0f, -value.X));
            LeftStickRight.UpdateWithRawValue(Math.Max(0.0f, value.X));

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