Ejemplo n.º 1
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (GameManager.Instance.CurrentState == GameManager.GameState.GAME)
     {
         float rotationInput = Input.GetAxis("Horizontal");
         float speedInput    = Input.GetAxis("Vertical");
         if (nbCarShake > 0)
         {
             carShakeTimer += Time.deltaTime * currentCarFrequencyGain;
             transform.Rotate(Vector3.forward, Mathf.Sin(carShakeTimer) * currentCarAmplitudeGain);
         }
         else
         {
             transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0);
             carMovement.Movement(rotationInput, speedInput);
         }
         gameUiManager.DisplaySpeed(carMovement.CurrentSpeed / carMovement.MaxSpeed);
         gameUiManager.DisplayLife(maxLife, Mathf.Abs(currentLife));
     }
 }