Example #1
0
    private void UpdateFlickGesture()
    {
        if (!IsFlickGesture)
        {
            return;
        }

        // Slowdown a little.
        dragVelocity *= FlickAcceleration;
        if ((dragVelocity.magnitude * Time.deltaTime) < FlickGestureThresholdInPixels ||
            songRouletteItems.IsNullOrEmpty() ||
            InputUtils.AnyMouseButtonPressed() ||
            (flickGestureWasNoTouchscreenPressed && InputUtils.AnyTouchscreenPressed()))
        {
            // End flick-gesture
            IsFlickGesture = false;
            dragVelocity   = Vector2.zero;
            OnEndDrag(Vector2.zero);
            return;
        }

        // Stop flick when the touchscreen was pressed again (i.e., a rising flank).
        flickGestureWasNoTouchscreenPressed = flickGestureWasNoTouchscreenPressed || !InputUtils.AnyTouchscreenPressed();

        // Simulate drag in flick direction.
        SongRouletteItem flickSongRouletteItem = songRouletteItems.FirstOrDefault(it => it.SongMeta == SelectedSongMeta);

        OnDrag(flickSongRouletteItem, dragVelocity * Time.deltaTime);
    }