public Vector2 GameAxis2DValue(int controllerId, Pinou2DAxis axis)
            {
                int     index = (int)axis;
                Vector2 value = Data.GameAxes[index].Axis2DValue(controllerId);

                ControllerType cType = GetControllerType(controllerId);

                if (Data.GameAxes[index].StickSide != StickSide.None && cType != ControllerType.Keyboard)
                {
                    if (cType == ControllerType.PS4)
                    {
                        switch (Data.GameAxes[index].StickSide)
                        {
                        case StickSide.Left:
                            value = PinouUtils.Maths.DeadzoneVector(value,
                                                                    Data.PS4Sensitivity.LeftStick.InnerDeadZone,
                                                                    Data.PS4Sensitivity.LeftStick.OutDeadZone,
                                                                    Data.PS4Sensitivity.LeftStick.Linearity);
                            break;

                        case StickSide.Right:
                            value = PinouUtils.Maths.DeadzoneVector(value,
                                                                    Data.PS4Sensitivity.RightStick.InnerDeadZone,
                                                                    Data.PS4Sensitivity.RightStick.OutDeadZone,
                                                                    Data.PS4Sensitivity.RightStick.Linearity);
                            value.x *= Data.PS4Sensitivity.RightStick.HSensitivity;
                            value.y *= Data.PS4Sensitivity.RightStick.VSensitivity;
                            break;
                        }
                    }
                    else
                    {
                        switch (Data.GameAxes[index].StickSide)
                        {
                        case StickSide.Left:
                            value = PinouUtils.Maths.DeadzoneVector(value,
                                                                    Data.XBoxSensitivity.LeftStick.InnerDeadZone,
                                                                    Data.XBoxSensitivity.LeftStick.OutDeadZone,
                                                                    Data.XBoxSensitivity.LeftStick.Linearity);
                            break;

                        case StickSide.Right:
                            value = PinouUtils.Maths.DeadzoneVector(value,
                                                                    Data.XBoxSensitivity.RightStick.InnerDeadZone,
                                                                    Data.XBoxSensitivity.RightStick.OutDeadZone,
                                                                    Data.XBoxSensitivity.RightStick.Linearity);
                            value.x *= Data.XBoxSensitivity.RightStick.HSensitivity;
                            value.y *= Data.XBoxSensitivity.RightStick.VSensitivity;
                            break;
                        }
                    }
                }

                return(value);
            }
示例#2
0
        public Vector2 GetPinouAxis2D(Pinou2DAxis axis)
        {
            switch (axis)
            {
            case Pinou2DAxis.Game_Move:
                return(Game_Move);

            case Pinou2DAxis.Editor_CameraMove:
                return(Editor_CameraMove);

            case Pinou2DAxis.Editor_CameraAim:
                return(Editor_CameraAim);
            }

            throw new System.Exception("No Axis " + axis + " found.");
        }