Exemple #1
0
 private void FixedUpdate()
 {
     if (PlayerPrefs.GetInt("onPlay") == 1)
     {
         // pass the input to the car!
         float h = CrossPlatformInputManager.GetAxis("Horizontal");
         float v = CrossPlatformInputManager.GetAxis("Vertical");
         m_Car.Move(h, v, v, 0f);
         //float jump = CrossPlatformInputManager.GetAxis ("Jump");
         if (Input.GetKeyDown(KeyCode.Minus))
         {
             m_Car.Jump(jumpForce);
         }
         if (transform.up [1] < -0.9f && transform.up [1] > -1.0f)
         {
             //PlayerPrefs.SetInt ("onPlay", 0);
             transform.Translate(Vector3.up * 2);
             transform.Rotate(transform.forward * 180.0f);
         }
         else if (transform.position.y < 0)
         {
             float dist = transform.position.y;
             transform.Translate(Vector3.up * (dist + 1.0f));
         }
     }
 }