コード例 #1
0
 void Jump()
 {
     if (rightFingerAction == FingerAction.shortTap)
     {
         rightFingerAction = FingerAction.off;
         moveDirection.y   = jumpSpeed;
         Debug.Log("jumped");
     }
 }
コード例 #2
0
 void Start()
 {
     // isMobile = (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer);
     isMobile = true;
     Debug.Log("isMobile = " + isMobile);
     controller           = GetComponent <CharacterController>();
     leftMinDragDistance  = 5;
     rightMinDragDistance = 20;
     eventSystem          = EventSystem.current;
     touchPositionsDict   = new TouchPositionsDict(eventSystem);
     rightFingerAction    = FingerAction.off;
 }
コード例 #3
0
 void CheckTypeOfTap(float start)
 {
     if (Time.time - start > tapLength)
     {
         Debug.Log("long tap");
         rightFingerAction = FingerAction.longTap;
     }
     else
     {
         Debug.Log("Short tap");
         rightFingerAction = FingerAction.shortTap;
     }
 }
コード例 #4
0
 void Scale()
 {
     if (MultiMove && Application.platform == RuntimePlatform.Android)
     {
         if (action == FingerAction.none)
         {
             var a = this[0].deltaPosition;
             var b = this[1].deltaPosition;
             if (MinCheck(a) && MinCheck(b))
             {
                 if (Different(a, b))
                 {
                     action = FingerAction.scale;
                 }
             }
         }
         if (action == FingerAction.scale)
         {
             var a = this[0].deltaPosition;
             var b = this[1].deltaPosition;
             if (Different(a, b))
             {
                 _ScaleChange(-GetScale(this[0], this[1]) / Screen.height);
             }
             else
             {
                 action = FingerAction.none;
             }
         }
     }
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         if (MinCheck(Input.GetAxis("Mouse ScrollWheel")))
         {
             _ScaleChange(-Input.GetAxis("Mouse ScrollWheel"));
         }
     }
 }