Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach(var touchInfo in Touch.GetData (0)){
- //If there's no racket finger ID...
- if(this.finger_ID == 0){
- //If you PRESS near the racket...
- if( touchInfo.X > (this.x - 25) && touchInfo.X < (this.x + 25)){
- //Set the racket finger ID!!
- if(touchInfo.Status == TouchStatus.Down){
- this.finger_ID = touchInfo.ID;
- break;
- }
- }
- //If the racket has a finger ID...
- }else{
- //If you release the finger, the racket finger ID will be 0.
- if(touchInfo.Status == TouchStatus.Canceled || touchInfo.Status == TouchStatus.Up){
- this.finger_ID = 0;
- break;
- //If you press and there's no racket finger ID, set the racket finger ID
- }else if(touchInfo.Status == TouchStatus.Down){
- this.finger_ID = touchInfo.ID;
- break;
- //If you move the finger and there's a racket finger ID, just move the racket :)
- }else if(touchInfo.Status == TouchStatus.Move){
- //If you MOVE near the racket...
- if( touchInfo.X > (this.x - 25) && touchInfo.X < (this.x + 25)){
- this.y = (touchInfo.Y + 0.5f) * 544;
- }
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement