AxisData GetAxisData(int index) { AxisData data = null; SerializedProperty property = null; if (null != _axesArray && _axesArray.arraySize > index) { property = _axesArray.GetArrayElementAtIndex(index); } if (null != property) { data = new AxisData(); data.ReadProperties(property); } return data; }
void CreateAxesTattieBogle() { AxisData[] axes = new AxisData[4]; AxisData rightX = axes[0] = new AxisData(); rightX.Name = GamePadXboxTattieBogle.RightX; rightX.DescriptiveName = "Xbox (TB) right horizontal input"; rightX.DeadZone = 0.19f; rightX.Sensitivity = 1.0f; rightX.Type = (int)AxisType.JoystickAxis; rightX.Axis = 2; rightX.JoystickNumber = 0; AxisData rightY = axes[1] = new AxisData(); rightY.Name = GamePadXboxTattieBogle.RightY; rightY.DescriptiveName = "Xbox (TB) right vertical input"; rightY.DeadZone = 0.19f; rightY.Sensitivity = 1.0f; rightY.Type = (int)AxisType.JoystickAxis; rightY.Axis = 3; rightY.Invert = true; // An inversion is required here also. rightY.JoystickNumber = 0; AxisData triggerL = axes[2] = new AxisData(); triggerL.Name = GamePadXboxTattieBogle.LeftTrigger; triggerL.DescriptiveName = "Xbox (TB) left trigger"; triggerL.DeadZone = 0.19f; triggerL.Sensitivity = 1.0f; triggerL.Type = (int)AxisType.JoystickAxis; triggerL.Axis = 4; triggerL.JoystickNumber = 0; AxisData triggerR = axes[3] = new AxisData(); triggerR.Name = GamePadXboxTattieBogle.RightTrigger; triggerR.DescriptiveName = "Xbox (TB) right trigger"; triggerR.DeadZone = 0.19f; triggerR.Sensitivity = 1.0f; triggerR.Type = (int)AxisType.JoystickAxis; triggerR.Axis = 5; triggerR.JoystickNumber = 0; _defaultAxes.Add(typeof(GamePadXboxTattieBogle), axes); }
void CreateAxesPC() { AxisData[] axes = new AxisData[5]; AxisData rightX = axes[0] = new AxisData(); rightX.Name = GamePadXboxPC.RightX; rightX.DescriptiveName = "Xbox right horizontal input"; rightX.DeadZone = 0.19f; rightX.Sensitivity = 1.0f; rightX.Type = (int)AxisType.JoystickAxis; rightX.Axis = 3; rightX.JoystickNumber = 0; AxisData rightY = axes[1] = new AxisData(); rightY.Name = GamePadXboxPC.RightY; rightY.DescriptiveName = "Xbox right vertical input"; rightY.DeadZone = 0.19f; rightY.Sensitivity = 1.0f; rightY.Type = (int)AxisType.JoystickAxis; rightY.Axis = 4; rightY.Invert = true; // An inversion is required here also. rightY.JoystickNumber = 0; AxisData triggerL = axes[2] = new AxisData(); triggerL.Name = GamePadXboxPC.Trigger; triggerL.DescriptiveName = "Xbox triggers"; triggerL.DeadZone = 0.19f; triggerL.Sensitivity = 1.0f; triggerL.Type = (int)AxisType.JoystickAxis; triggerL.Axis = 2; triggerL.JoystickNumber = 0; AxisData dpadL = axes[3] = new AxisData(); dpadL.Name = GamePadXboxPC.DpadX; dpadL.DescriptiveName = "Xbox dpad horizontal input"; dpadL.DeadZone = 0.19f; dpadL.Sensitivity = 1.0f; dpadL.Type = (int)AxisType.JoystickAxis; dpadL.Axis = 5; dpadL.JoystickNumber = 0; AxisData dpadR = axes[4] = new AxisData(); dpadR.Name = GamePadXboxPC.DpadY; dpadR.DescriptiveName = "Xbox dpad vertical input"; dpadR.DeadZone = 0.19f; dpadR.Sensitivity = 1.0f; dpadR.Type = (int)AxisType.JoystickAxis; dpadR.Axis = 6; dpadR.JoystickNumber = 0; _defaultAxes.Add(typeof(GamePadXboxPC), axes); }
void CreateAxesPs3() { AxisData[] axes = new AxisData[2]; AxisData rightX = axes[0] = new AxisData(); rightX.Name = GamePadPS3.RightX; rightX.DescriptiveName = "PS3 right horizontal input"; rightX.DeadZone = 0.19f; rightX.Sensitivity = 1.0f; rightX.Type = (int)AxisType.JoystickAxis; rightX.Axis = 2; rightX.JoystickNumber = 0; // Capture from all connected AxisData rightY = axes[1] = new AxisData(); rightY.Name = GamePadPS3.RightY; rightY.DescriptiveName = "PS3 right vertical input"; rightY.DeadZone = 0.19f; rightY.Sensitivity = 1.0f; rightY.Type = (int)AxisType.JoystickAxis; rightY.Axis = 3; rightY.Invert = true; // Apparently we need to flip the right stick to make it match the left. rightY.JoystickNumber = 0; _defaultAxes.Add(typeof(GamePadPS3), axes); }
public AxisData Clone() { AxisData cloned = new AxisData(); FieldInfo[] fields = GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach(FieldInfo field in fields) { field.SetValue(cloned, field.GetValue(this)); } return cloned; }