コード例 #1
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 || LeftStickLeft.Raw || LeftStickRight.Raw || LeftStickUp.Raw || LeftStickDown.Raw)
            {
                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);
        }
コード例 #2
0
 internal void CommitLeftStick()
 {
     LeftStickUp.Commit();
     LeftStickDown.Commit();
     LeftStickLeft.Commit();
     LeftStickRight.Commit();
 }
コード例 #3
0
ファイル: InputDevice.cs プロジェクト: zachvp/splorp-inc
 public void CommitLeftStick()
 {
     LeftStickUp.Commit();
     LeftStickDown.Commit();
     LeftStickLeft.Commit();
     LeftStickRight.Commit();
 }
コード例 #4
0
        internal void ProcessLeftStick()
        {
            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);

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

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

            LeftStickLeft.SetValue(LeftStick.Left.Value);
            LeftStickRight.SetValue(LeftStick.Right.Value);
            LeftStickUp.SetValue(LeftStick.Up.Value);
            LeftStickDown.SetValue(LeftStick.Down.Value);
        }
コード例 #5
0
ファイル: InputDevice.cs プロジェクト: yuchenwuhen/Incontrol
    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);
    }
コード例 #6
0
ファイル: InputDevice.cs プロジェクト: hoylemd/survivor-mars
        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);
            }
        }
コード例 #7
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));
            }
        }