-
Notifications
You must be signed in to change notification settings - Fork 4
unity input
Peter Klooster edited this page Mar 13, 2019
·
1 revision
// Holds the [DeviceMotion](#DeviceMotion) object
public DeviceMotion Motion { get; private set; }
// Holds the [DeviceOrientation](#DeviceOrientation) object
public DeviceOrientation Orientation { get; private set; }
// Holds the [TouchSwipe](#TouchSwipe) object
public TouchSwipe Swipe { get; private set; }
// Holds the [TouchPan](#TouchPan) object
public TouchPan Pan { get; private set; }// Returns true if the button was pressed this frame
public bool GetKey (string key) {}
// Returns true if the button was pressed down this frame
public bool GetKeyDown (string key) {}
// True if the button was released this frame.
// Note: Only works for "hold" buttons
public bool GetKeyUp (string key) {}
// Returns the x axis of an input vector
public float GetHorizontalAxis(string key)
// Returns the y axis of an input vector
public float GetVerticalAxis(string key)
// Returns the vector of a given key
public Vector2 GetVector(string key)// Holds the acceleration of this device, including gravity
public Vector3 GravityAcceleration { get; private set; }
// Returns the roll compared to the desired state
public float GetRoll(DeviceOrientation.STATE state){}
// Returns the tilt compared to the desired state
public float GetTilt(DeviceOrientation.STATE state){}// The current state: UNKNOWN, FLAT, PORTRAIT, LEFT, RIGHT
public STATE State { get; private set; }
// The raw data
public float Alpha { get; private set; }
public float Beta { get; private set; }
public float Gamma { get; private set; }
// Wrappers
public float X { get { return Beta; } }
public float Y { get { return Alpha; } }
public float Z { get { return Gamma; } }
// Returns the euler angles base on the data
public Vector3 EulerAngles// The position (in screen pixels) when the event started
public Vector2 StartPosition { get; private set; }
// The current position (in screen pixels)
public Vector2 CurrentPosition { get; private set; }
// Returns true on the first frame of this event
public bool IsTouchStart { get; }
// Returns true during all frames of this event
public bool IsTouching { get; }
// Returns true on the last frame of this event
public bool IsTouchEnd { get; }
// Calls the input action when IsTouchStart
public void TouchStart (Action<Vector2> callback){}
// Calls the input action when IsTouching
public void Touching (Action<Vector2, Vector2> callback){}
// Calls the input action when IsTouchEnd
public void TouchEnd (Action<Vector2, Vector2> callback) {}// The direction of the last event
public DIRECTION Direction { get; private set; }
// True if there was a swipe event this frame
public bool IsSwiped { get; }
// The callback gets called when a swipe event happens
public void Swiped (Action<DIRECTION> callback){}
// The callback gets called when a swipe up event happens
public void SwipedUp (Action callback){}
// The callback gets called when a swipe down event happens
public void SwipedDown(Action callback){}
// The callback gets called when a swipe left event happens
public void SwipedLeft(Action callback){}
// The callback gets called when a swipe right event happens
public void SwipedRight(Action callback){}