Exemplo n.º 1
0
 public static Vector3 GetTouchPosition()
 {
     if (Application.isEditor)
     {
         TouchInfo touch = App_Touch.GetTouch();
         if (touch != TouchInfo.None)
         {
             Position      = Input.mousePosition;
             Position.z    = 20.0f;
             Worldposition = Camera.main.ScreenToWorldPoint(Position);
             return(Worldposition);
         }
     }
     else
     {
         if (Input.touchCount > 0)
         {
             Touch touch = Input.GetTouch(0);
             TouchPosition.x = touch.position.x;
             TouchPosition.y = touch.position.y;
             TouchPosition.z = 20.0f;
             Worldposition   = Camera.main.ScreenToWorldPoint(TouchPosition);
             return(Worldposition);
         }
     }
     return(Vector3.zero);
 }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     touch = App_Touch.GetTouch();
     if ((touch == App_Touch.TouchInfo.Began) && !gameover)
     {
         Jump();
     }
     if (gameover == true)
     {
         anim.SetBool("gameover", true);
         gameoverui.SendMessage("Lose");
     }
 }
Exemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     /*this.GetComponent<Rigidbody> ().AddForce (
      *      transform.right * Input.GetAxisRaw ("Horizontal") * accel,
      *      ForceMode.Impulse);*/
     App_Touch.TouchInfo touch = App_Touch.GetTouch();
     if (touch == App_Touch.TouchInfo.Began)
     {
     }
     if (touch == App_Touch.TouchInfo.Moved)
     {
         pos   = App_Touch.GetTouchPosition();
         pos.y = 0.0f;
         pos.z = -6.0f;
         transform.position = pos;
     }
     if (touch == App_Touch.TouchInfo.Ended)
     {
     }
 }