public override List <UnityInputAxes> fetchMappingObject(string name, AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING control, AutoGamepadConstants.UNITY_PLAYER_NUMBER player) { List <UnityInputAxes> inputAxisCollection = new List <UnityInputAxes>(); UnityInputAxes inputAxis; switch (control) { case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.LeftStickHorizontal: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Analog, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.LeftStickVertical: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Analog, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.Y_Axis_2nd, true); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.RightStickHorizontal: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Analog, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.FourthAxis, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.RightStickVertical: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Analog, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.FifthAxis, true); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.DpadHorizontal: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.SixthAxis, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.DpadVertical: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.SeventhAxis, true); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.TriggersCombined_ControllerSpecific: inputAxis = null; break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.LeftTrigger_ControllerSpecific: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Analog, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.EighthAxis, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.RightTrigger_ControllerSpecific: inputAxis = createAxis(name, "", "", player, AutoGamepadConstants.ITEM_TYPE.Analog, AutoGamepadConstants.UNITY_AXIS_TYPE.JoystickAxis, AutoGamepadConstants.UNITY_AXIS_NUMBER.ThirdAxis, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.A_Button: inputAxis = createAxis(name, "button 0", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.B_Button: inputAxis = createAxis(name, "button 1", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.X_Button: inputAxis = createAxis(name, "button 2", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.Y_Button: inputAxis = createAxis(name, "button 3", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.LeftBumper: inputAxis = createAxis(name, "button 4", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.RightBumper: inputAxis = createAxis(name, "button 5", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.Start: inputAxis = createAxis(name, "button 7", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.Back_ControllerSpecific: inputAxis = null; break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.LeftStickPush_ControllerSpecific: inputAxis = createAxis(name, "button 8", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.RightStickPush_ControllerSpecific: inputAxis = createAxis(name, "button 9", "", player, AutoGamepadConstants.ITEM_TYPE.Digital, AutoGamepadConstants.UNITY_AXIS_TYPE.KeyOrMouseButton, AutoGamepadConstants.UNITY_AXIS_NUMBER.X_Axis_1st, false); break; case AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING.None: inputAxis = null; break; default: inputAxis = null; break; } if (inputAxis != null) { inputAxisCollection.Add(inputAxis); } return(inputAxisCollection); }
public string fetchControllerPrefix(AutoGamepadConstants.UNITY_PLAYER_NUMBER player) { string returnString = ""; switch (player) { case AutoGamepadConstants.UNITY_PLAYER_NUMBER.GetMotionFromAllJoysticks: returnString = "joystick "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick1: returnString = "joystick 1 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick2: returnString = "joystick 2 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick3: returnString = "joystick 3 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick4: returnString = "joystick 4 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick5: returnString = "joystick 5 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick6: returnString = "joystick 6 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick7: returnString = "joystick 7 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick8: returnString = "joystick 8 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick9: returnString = "joystick 9 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick10: returnString = "joystick 10 "; break; case AutoGamepadConstants.UNITY_PLAYER_NUMBER.Joystick11: returnString = "joystick 11 "; break; default: returnString = "joystick "; break; } return(returnString); }
public UnityInputAxes createAxis(string name, string positiveControlName, string negativeControlName, AutoGamepadConstants.UNITY_PLAYER_NUMBER player, AutoGamepadConstants.ITEM_TYPE type, AutoGamepadConstants.UNITY_AXIS_TYPE unityType, AutoGamepadConstants.UNITY_AXIS_NUMBER axisNumber, bool invert) { UnityInputAxes inputAxis = new UnityInputAxes(); inputAxis.name = name; if (!positiveControlName.Equals("")) { if (positiveControlName.Equals("escape")) { inputAxis.positiveButton = "escape"; } else { inputAxis.positiveButton = fetchControllerPrefix(player) + positiveControlName; } } if (!negativeControlName.Equals("")) { if (negativeControlName.Equals("escape")) { inputAxis.negativeButton = "escape"; } else { inputAxis.negativeButton = fetchControllerPrefix(player) + negativeControlName; } } if (type == AutoGamepadConstants.ITEM_TYPE.Digital) { inputAxis.sensitivity = (AutoGamepadGenerator.overrideCollection[name].sensitivity == 0f) ? 1000f : AutoGamepadGenerator.overrideCollection[name].sensitivity; inputAxis.gravity = (AutoGamepadGenerator.overrideCollection[name].gravity == 0f) ? 1000f : AutoGamepadGenerator.overrideCollection[name].gravity; inputAxis.dead = (AutoGamepadGenerator.overrideCollection[name].dead == 0f) ? .001f : AutoGamepadGenerator.overrideCollection[name].dead; } else { inputAxis.sensitivity = (AutoGamepadGenerator.overrideCollection[name].sensitivity == 0f) ? 1f : AutoGamepadGenerator.overrideCollection[name].sensitivity; inputAxis.gravity = (AutoGamepadGenerator.overrideCollection[name].gravity == 0f) ? 0f : AutoGamepadGenerator.overrideCollection[name].gravity; inputAxis.dead = (AutoGamepadGenerator.overrideCollection[name].dead == 0f) ? .19f : AutoGamepadGenerator.overrideCollection[name].dead; } inputAxis.snap = (AutoGamepadGenerator.overrideCollection[name].snap == false) ? false : true; inputAxis.invert = (AutoGamepadGenerator.overrideCollection[name].invert == false) ? invert : !invert; inputAxis.type = unityType; inputAxis.axis = axisNumber; inputAxis.joyNum = player; inputAxis.descriptiveName = AutoGamepadConstants.GENERATED; return(inputAxis); }
public abstract List <UnityInputAxes> fetchMappingObject(string name, AutoGamepadConstants.DEFAULT_CONTROLLER_MAPPING control, AutoGamepadConstants.UNITY_PLAYER_NUMBER player);