Exemplo n.º 1
0
 void GetInputHorizontal()
 {
     if (Input.GetKey(KeyCode.LeftArrow) || bodyMovement.leanLeft())
     {
         horizontal += rotateHSpeed;
         tilt       += rotateHSpeed;
     }
     else if (Input.GetKey(KeyCode.RightArrow) || bodyMovement.leanRight())
     {
         horizontal -= rotateHSpeed;
         tilt       -= rotateHSpeed;
     }
     else
     {
         if (tilt > .1)
         {
             tilt -= rotateHSpeed;
         }
         else if (tilt < 0)
         {
             tilt += rotateHSpeed;
         }
     }
     tilt = Mathf.Clamp(tilt, -1f, 1f);
 }