public float GetHorizontalSwipe() { if (isSwipeReady) { float dx_pt = Screening.PixelsToPoints(delta.x) / Time.deltaTime; float ang_offset = Mathf.Sin(gesture.angle); if (spread <= maximumSpreadForSwipe && Mathf.Abs(ang_offset) < Mathf.Sin(Mathf.PI / 4f)) { return(dx_pt); } } return(0f); }
public bool GetTap(int touchId = 0) { if (numberOfTouches > touchId) { InputEventData touch = gesture.touches[touchId]; float sp = Screening.PixelsToPoints(touch.delta.magnitude) / Time.deltaTime; if (touch.state == InputEventData.State.Cancel && touch.timer <= tapThreshold && sp < tapMoveThreshold) { return(true); } } return(false); }