/// <summary> /// Adds a handler for joystick axis input. /// </summary> public static void AddInputHandler( DeviceType dt, OVRGamepadController.Axis axis, OnKeyDown onDown, OnKeyHeld onHeld, OnKeyUp onUp) { keyInfos.Add(new KeyInfo(dt, axis, onDown, onHeld, onUp)); }
// joystick axis constructor public KeyInfo(eDeviceType inDeviceType, OVRGamepadController.Axis inJoystickAxis, OnKeyDown inDownHandler, OnKeyHeld inHeldHandler, OnKeyUp inUpHandler) { DeviceType = inDeviceType; KeyName = OVRGamepadController.AxisNames[(int)inJoystickAxis]; MouseButton = eMouseButton.None; JoystickButton = OVRGamepadController.Button.None; JoystickAxis = inJoystickAxis; Threshold = 0.5f; WasDown = false; DownHandler = inDownHandler; HeldHandler = inHeldHandler; UpHandler = inUpHandler; }
/// <summary> /// Joystick axis constructor. /// </summary> public KeyInfo( DeviceType inDeviceType, OVRGamepadController.Axis inJoystickAxis, OnKeyDown inDownHandler, OnKeyHeld inHeldHandler, OnKeyUp inUpHandler) { deviceType = inDeviceType; keyName = OVRGamepadController.AxisNames[(int)inJoystickAxis]; mouseButton = MouseButton.None; joystickButton = OVRGamepadController.Button.None; joystickAxis = inJoystickAxis; threshold = 0.5f; wasDown = false; downHandler = inDownHandler; heldHandler = inHeldHandler; upHandler = inUpHandler; }
/// <summary> /// Mouse button constructor. /// </summary> public KeyInfo( DeviceType inDeviceType, MouseButton inMouseButton, OnKeyDown inDownHandler, OnKeyHeld inHeldHandler, OnKeyUp inUpHandler) { deviceType = inDeviceType; keyName = "Mouse Button " + (int)inMouseButton; mouseButton = inMouseButton; joystickButton = OVRGamepadController.Button.None; joystickAxis = OVRGamepadController.Axis.None; threshold = 1000.0f; wasDown = false; downHandler = inDownHandler; heldHandler = inHeldHandler; upHandler = inUpHandler; }
/// <summary> /// Joystick axis constructor. /// </summary> public KeyInfo( DeviceType inDeviceType, OVRGamepadController.Axis inJoystickAxis, OnKeyDown inDownHandler, OnKeyHeld inHeldHandler, OnKeyUp inUpHandler) { deviceType = inDeviceType; keyName = OVRGamepadController.AxisNames[(int)inJoystickAxis]; mouseButton = MouseButton.None; joystickButton = OVRGamepadController.Button.None; joystickAxis = inJoystickAxis; threshold = 0.5f; wasDown = false; downHandler = inDownHandler; heldHandler = inHeldHandler; upHandler = inUpHandler; }
/// <summary> /// Mouse button constructor. /// </summary> public KeyInfo( DeviceType inDeviceType, MouseButton inMouseButton, OnKeyDown inDownHandler, OnKeyHeld inHeldHandler, OnKeyUp inUpHandler) { deviceType = inDeviceType; keyName = "Mouse Button " + (int)inMouseButton; mouseButton = inMouseButton; joystickButton = OVRGamepadController.Button.None; joystickAxis = OVRGamepadController.Axis.None; threshold = 1000.0f; wasDown = false; downHandler = inDownHandler; heldHandler = inHeldHandler; upHandler = inUpHandler; }
/// <summary> /// Delegate for OVRGamepadController. /// This only exists for legacy compatibility with OVRGamepadController. /// </summary> public static float ReadJoystickAxis(OVRGamepadController.Axis axis) { //if (verbose) //Debug.Log("OVRInputControl.ReadJoystickAxis"); return(GetJoystickAxis(1, axis)); }
/// <summary> /// Delegate for OVRGamepadController. /// Returns the current value of the specified joystick axis. /// </summary> public static float GetJoystickAxis(int joystickNumber, OVRGamepadController.Axis axis) { string platformName = platformPrefix + "Joy " + joystickNumber + ":" + OVRGamepadController.AxisNames[(int)axis]; return(Input.GetAxis(platformName)); }
//====================== // ReadJoystickAxis // delegate for OVRGamepadController // This only exists for legacy compatibility with OVRGamepadController. //====================== public static float ReadJoystickAxis(OVRGamepadController.Axis axis) { //DebugUtils.Print( "InputControl.ReadJoystickAxis" ); return(GetJoystickAxis(1, axis)); }
// joystick axis constructor public KeyInfo( eDeviceType inDeviceType, OVRGamepadController.Axis inJoystickAxis, OnKeyDown inDownHandler, OnKeyHeld inHeldHandler, OnKeyUp inUpHandler ) { DeviceType = inDeviceType; KeyName = OVRGamepadController.AxisNames[(int)inJoystickAxis]; MouseButton = eMouseButton.None; JoystickButton = OVRGamepadController.Button.None; JoystickAxis = inJoystickAxis; Threshold = 0.5f; WasDown = false; DownHandler = inDownHandler; HeldHandler = inHeldHandler; UpHandler = inUpHandler; }
// mouse button constructor public KeyInfo( eDeviceType inDeviceType, eMouseButton inMouseButton, OnKeyDown inDownHandler, OnKeyHeld inHeldHandler, OnKeyUp inUpHandler ) { DeviceType = inDeviceType; KeyName = "Mouse Button " + (int)inMouseButton; MouseButton = inMouseButton; JoystickButton = OVRGamepadController.Button.None; JoystickAxis = OVRGamepadController.Axis.None; Threshold = 1000.0f; WasDown = false; DownHandler = inDownHandler; HeldHandler = inHeldHandler; UpHandler = inUpHandler; }