Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _currentSwipe = new Vector3( _secondClickPos.x - _firstClickPos.x, _secondClickPos.y - _firstClickPos.y );
- _currentSwipe.Normalize();
- //Swipe directional check
- // Swipe up
- if ( _currentSwipe.y > 0 && _currentSwipe.x > -0.5f && _currentSwipe.x < 0.5f ) {
- SwipeDirection = Swipe.Up;
- Debug.Log( "Up" );
- }
- // Swipe down
- else if ( _currentSwipe.y < 0 && _currentSwipe.x > -0.5f && _currentSwipe.x < 0.5f ) {
- SwipeDirection = Swipe.Down;
- Debug.Log( "Down" );
- }
- // Swipe left
- else if ( _currentSwipe.x < 0 && _currentSwipe.y > -0.5f && _currentSwipe.y < 0.5f ) {
- SwipeDirection = Swipe.Left;
- Debug.Log( "Left" );
- }
- // Swipe right
- else if ( _currentSwipe.x > 0 && _currentSwipe.y > -0.5f && _currentSwipe.y < 0.5f ) {
- SwipeDirection = Swipe.Right;
- Debug.Log( "right" );
- } // Swipe up left
- else if ( _currentSwipe.y > 0 && _currentSwipe.x < 0 ) {
- SwipeDirection = Swipe.UpLeft;
- Debug.Log( "UpLeft" );
- }
- // Swipe up right
- else if ( _currentSwipe.y > 0 && _currentSwipe.x > 0 ) {
- SwipeDirection = Swipe.UpRight;
- Debug.Log( "UpRight" );
- }
- // Swipe down left
- else if ( _currentSwipe.y < 0 && _currentSwipe.x < 0 ) {
- SwipeDirection = Swipe.DownLeft;
- Debug.Log( "DownLeft" );
- // Swipe down right
- } else if ( _currentSwipe.y < 0 && _currentSwipe.x > 0 ) {
- SwipeDirection = Swipe.DownRight;
- Debug.Log( "DownRight" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement