C# 클래스 OVRInputControl

Cross-platform wrapper for Unity Input. See OVRGamepadController for a list of the base axis and button names. Depending on joystick number and platform the base names will be pre-pended with "Platform:Joy #:" to look them up in the Unity Input table. For instance: using an axis name of "Left_X_Axis" with GetJoystickAxis() will result in looking up the axis named "Win: Joy 1: Left_X_Axis" when running on Windows and "Android: Joy 1: Left_X_Axis" when running on Android. In addition to wrapping joystick input, this class allows the assignment of up, held and down events for any key, mouse button, or joystick button via the AddInputHandler() method. Currently this class relies on enumerations defined in OVRGamepadController so that it remains compatible with existing Unity OVR projects. When this class is included it overloads the default GPC_GetAxis() and GPC_GetButton() calls to to ReadAxis() and ReadButton() in this class. Ideally this class would completely replace the OVRGamepadController class. This would involve changing the GPC_GetAxis() and GPC_GetButton() calls in a project and removing references to OVRGamepadController in this file (and moving some of the tables to InputControl).
파일 보기 프로젝트 열기: leapmotion/ImageGrid 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
verbose bool

공개 메소드들

메소드 설명
AddInputHandler ( DeviceType dt, MouseButton, mouseButton, OnKeyDown, onDown, OnKeyHeld onHeld, OnKeyUp onUp ) : void

Adds a handler for mouse button input.

AddInputHandler ( DeviceType dt, OVRGamepadController, joystickButton, OnKeyDown, onDown, OnKeyHeld onHeld, OnKeyUp onUp ) : void

Adds a handler for joystick button input.

AddInputHandler ( DeviceType dt, string keyName, OnKeyDown, onDown, OnKeyHeld onHeld, OnKeyUp onUp ) : void

Adds a handler for key input

AddInputMapping ( int joystickNumber, MonoBehaviour comp ) : void

Adds a mapping from a joystick to a behavior.

ClearControlMappings ( ) : void

Removes all control mappings.

GetJoystickAxis ( int joystickNumber, OVRGamepadController, axis ) : float

Delegate for OVRGamepadController. Returns the current value of the specified joystick axis.

GetJoystickAxis ( int joystickNumber, string name ) : float

Returns the current value of the joystick axis specified by the name parameter. The name should partially match the name of an axis specified in the Unity Edit -> Project Settings -> Input pane, minus the Platform: Joy #: qualifiers. For instance, specify "Left_X_Axis" to select the appropriate axis for the current platform. This will be permuted into something like "Win:Joy 1:Left_X_Axis" before it is queried.

GetJoystickButton ( int joystickNumber, OVRGamepadController, button ) : bool

Delegate for OVRGamepadController. Returns true if the specified joystick button is pressed.

GetJoystickButton ( int joystickNumber, string name ) : bool

Returns true if a joystick button is depressed. The name should partially match the name of an axis specified in the Unity Edit -> Project Settings -> Input pane, minus the Platform: Joy #: qualifiers. For instance, specify "Button A" to select the appropriate axis for the current platform. This will be permuted into something like "Win:Joy 1:Button A" before it is queried.

GetMouseButton ( MouseButton, button ) : bool
ReadJoystickAxis ( OVRGamepadController, axis ) : float

Delegate for OVRGamepadController. This only exists for legacy compatibility with OVRGamepadController.

ReadJoystickButton ( OVRGamepadController, button ) : bool

Delegate for OVRGamepadController. This only exists for legacy compatibility with OVRGamepadController.

RemoveInputMapping ( int joystickNumber, MonoBehaviour comp ) : void

Removes a mapping from a joystick to a behavior.

Update ( ) : void

Updates the state of all input mappings. This must be called from a single MonoBehaviour's Update() method for input to be read.

비공개 메소드들

메소드 설명
Init_Android ( ) : void

Initializes the input system for Android.

Init_OSX ( ) : void

Initializes the input system for OSX.

Init_OSX_Editor ( ) : void

Initializes the input system for OSX when running from the Unity editor.

Init_Windows ( ) : void

Initializes the input system for OSX.

Init_Windows_Editor ( ) : void

Initializes the input system for Windows when running from the Unity editor.

Init_iPhone ( ) : void

Initializes the input system for iPhone.

OVRInputControl ( ) : UnityEngine

Static contructor for the OVRInputControl class.

ShowAxisValues ( ) : void

Outputs debug spam for any non-zero axis. This is only used for finding which axes are which with new controllers.

ShowButtonValues ( ) : void

Outputs debug spam for any depressed button. This is only used for finding which buttons are which with new controllers.

UpdateInputMapping ( int joystickNumber, MonoBehaviour comp ) : void

Updates a single input mapping.

메소드 상세

AddInputHandler() 공개 정적인 메소드

Adds a handler for mouse button input.
public static AddInputHandler ( DeviceType dt, MouseButton, mouseButton, OnKeyDown, onDown, OnKeyHeld onHeld, OnKeyUp onUp ) : void
dt DeviceType
mouseButton MouseButton,
onDown OnKeyDown,
onHeld OnKeyHeld
onUp OnKeyUp
리턴 void

AddInputHandler() 공개 정적인 메소드

Adds a handler for joystick button input.
public static AddInputHandler ( DeviceType dt, OVRGamepadController, joystickButton, OnKeyDown, onDown, OnKeyHeld onHeld, OnKeyUp onUp ) : void
dt DeviceType
joystickButton OVRGamepadController,
onDown OnKeyDown,
onHeld OnKeyHeld
onUp OnKeyUp
리턴 void

AddInputHandler() 공개 정적인 메소드

Adds a handler for key input
public static AddInputHandler ( DeviceType dt, string keyName, OnKeyDown, onDown, OnKeyHeld onHeld, OnKeyUp onUp ) : void
dt DeviceType
keyName string
onDown OnKeyDown,
onHeld OnKeyHeld
onUp OnKeyUp
리턴 void

AddInputMapping() 공개 정적인 메소드

Adds a mapping from a joystick to a behavior.
public static AddInputMapping ( int joystickNumber, MonoBehaviour comp ) : void
joystickNumber int
comp MonoBehaviour
리턴 void

ClearControlMappings() 공개 정적인 메소드

Removes all control mappings.
public static ClearControlMappings ( ) : void
리턴 void

GetJoystickAxis() 공개 정적인 메소드

Delegate for OVRGamepadController. Returns the current value of the specified joystick axis.
public static GetJoystickAxis ( int joystickNumber, OVRGamepadController, axis ) : float
joystickNumber int
axis OVRGamepadController,
리턴 float

GetJoystickAxis() 공개 정적인 메소드

Returns the current value of the joystick axis specified by the name parameter. The name should partially match the name of an axis specified in the Unity Edit -> Project Settings -> Input pane, minus the Platform: Joy #: qualifiers. For instance, specify "Left_X_Axis" to select the appropriate axis for the current platform. This will be permuted into something like "Win:Joy 1:Left_X_Axis" before it is queried.
public static GetJoystickAxis ( int joystickNumber, string name ) : float
joystickNumber int
name string
리턴 float

GetJoystickButton() 공개 정적인 메소드

Delegate for OVRGamepadController. Returns true if the specified joystick button is pressed.
public static GetJoystickButton ( int joystickNumber, OVRGamepadController, button ) : bool
joystickNumber int
button OVRGamepadController,
리턴 bool

GetJoystickButton() 공개 정적인 메소드

Returns true if a joystick button is depressed. The name should partially match the name of an axis specified in the Unity Edit -> Project Settings -> Input pane, minus the Platform: Joy #: qualifiers. For instance, specify "Button A" to select the appropriate axis for the current platform. This will be permuted into something like "Win:Joy 1:Button A" before it is queried.
public static GetJoystickButton ( int joystickNumber, string name ) : bool
joystickNumber int
name string
리턴 bool

GetMouseButton() 공개 정적인 메소드

public static GetMouseButton ( MouseButton, button ) : bool
button MouseButton,
리턴 bool

ReadJoystickAxis() 공개 정적인 메소드

Delegate for OVRGamepadController. This only exists for legacy compatibility with OVRGamepadController.
public static ReadJoystickAxis ( OVRGamepadController, axis ) : float
axis OVRGamepadController,
리턴 float

ReadJoystickButton() 공개 정적인 메소드

Delegate for OVRGamepadController. This only exists for legacy compatibility with OVRGamepadController.
public static ReadJoystickButton ( OVRGamepadController, button ) : bool
button OVRGamepadController,
리턴 bool

RemoveInputMapping() 공개 정적인 메소드

Removes a mapping from a joystick to a behavior.
public static RemoveInputMapping ( int joystickNumber, MonoBehaviour comp ) : void
joystickNumber int
comp MonoBehaviour
리턴 void

Update() 공개 정적인 메소드

Updates the state of all input mappings. This must be called from a single MonoBehaviour's Update() method for input to be read.
public static Update ( ) : void
리턴 void

프로퍼티 상세

verbose 공개적으로 정적으로 프로퍼티

If true, prints information about each input event to the log.
public static bool verbose
리턴 bool