void Update(){
if (Input.touchCount > 0) {
float veritcalSpace = 50;
Touch touch = Input.touches [0];
switch (touch.phase) {
case(TouchPhase.Began):
startx = Input.GetTouch(0).position.x;
starty = Input.GetTouch(0).position.y;
// Debug.Log(starty);
break;
case(TouchPhase.Ended):
endx = Input.GetTouch(0).position.x;
endy = Input.GetTouch(0).position.y;
if(startx < objectx && endx > objectx && ((starty > objecty-veritcalSpace && endy < objecty+veritcalSpace) || (starty < objecty+veritcalSpace && endy > objecty-veritcalSpace))){
Wait ();
}
else if(startx > objectx && endx < objectx && ((starty > objecty-veritcalSpace && endy < objecty+veritcalSpace) || (starty < objecty+veritcalSpace && endy > objecty-veritcalSpace))){
Wait ();
}
break;
}
}
}