Esempio n. 1
0
 public static Vector3 GetDeltaPosition(int i)
 {
     if (Application.isEditor)
     {
         TouchInfo info = MultiPlatformTouchUtils.GetTouch(i);
         if (info != TouchInfo.None)
         {
             Vector3 currentPosition = Input.mousePosition;
             Vector3 delta           = currentPosition - PreviousPosition;
             PreviousPosition = currentPosition;
             return(delta);
         }
     }
     else
     {
         if (Input.touchCount >= i)
         {
             Touch touch = Input.GetTouch(i);
             PreviousPosition.x = touch.deltaPosition.x;
             PreviousPosition.y = touch.deltaPosition.y;
             return(PreviousPosition);
         }
     }
     return(Vector3.zero);
 }
Esempio n. 2
0
 /// <summary>
 /// タッチポジションを取得(エディタと実機を考慮)
 /// </summary>
 /// <returns>タッチポジション。タッチされていない場合は (0, 0, 0)</returns>
 public static Vector3 GetTouchPosition(int i)
 {
     if (Application.isEditor)
     {
         TouchInfo touch = MultiPlatformTouchUtils.GetTouch(i);
         if (touch != TouchInfo.None)
         {
             PreviousPosition = Input.mousePosition;
             return(PreviousPosition);
         }
     }
     else
     {
         if (Input.touchCount >= i)
         {
             Touch touch = Input.GetTouch(i);
             TouchPosition.x = touch.position.x;
             TouchPosition.y = touch.position.y;
             return(TouchPosition);
         }
     }
     return(Vector3.zero);
 }