Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.02 KB | None | 0 0
  1. _currentSwipe = new Vector3( _secondClickPos.x - _firstClickPos.x, _secondClickPos.y - _firstClickPos.y );
  2.  
  3. _currentSwipe.Normalize();
  4.  
  5. //Swipe directional check
  6.                 // Swipe up
  7.                 if ( _currentSwipe.y > 0 && _currentSwipe.x > -0.5f && _currentSwipe.x < 0.5f ) {
  8.                     SwipeDirection = Swipe.Up;
  9.                     Debug.Log( "Up" );
  10.                 }
  11.                     // Swipe down
  12.                 else if ( _currentSwipe.y < 0 && _currentSwipe.x > -0.5f && _currentSwipe.x < 0.5f ) {
  13.                     SwipeDirection = Swipe.Down;
  14.                     Debug.Log( "Down" );
  15.                 }
  16.                     // Swipe left
  17.                 else if ( _currentSwipe.x < 0 && _currentSwipe.y > -0.5f && _currentSwipe.y < 0.5f ) {
  18.                     SwipeDirection = Swipe.Left;
  19.                     Debug.Log( "Left" );
  20.                 }
  21.                     // Swipe right
  22.                 else if ( _currentSwipe.x > 0 && _currentSwipe.y > -0.5f && _currentSwipe.y < 0.5f ) {
  23.                     SwipeDirection = Swipe.Right;
  24.                     Debug.Log( "right" );
  25.                 }     // Swipe up left
  26.                 else if ( _currentSwipe.y > 0 && _currentSwipe.x < 0 ) {
  27.                     SwipeDirection = Swipe.UpLeft;
  28.                     Debug.Log( "UpLeft" );
  29.  
  30.                 }
  31.                     // Swipe up right
  32.                 else if ( _currentSwipe.y > 0 && _currentSwipe.x > 0 ) {
  33.                     SwipeDirection = Swipe.UpRight;
  34.                     Debug.Log( "UpRight" );
  35.  
  36.                 }
  37.                     // Swipe down left
  38.                 else if ( _currentSwipe.y < 0 && _currentSwipe.x < 0 ) {
  39.                     SwipeDirection = Swipe.DownLeft;
  40.                     Debug.Log( "DownLeft" );
  41.                     // Swipe down right
  42.                 } else if ( _currentSwipe.y < 0 && _currentSwipe.x > 0 ) {
  43.                     SwipeDirection = Swipe.DownRight;
  44.                     Debug.Log( "DownRight" );
  45.                 }
  46.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement