Exemple #1
0
 private void FixedUpdate()
 {
     if (isGameOver)
     {
         return;
     }
     if (shot && force != 0)
     {
         timeSinceShot += Time.fixedDeltaTime;
         ballSpeed      = force / inertia / timeSinceShot * Time.fixedDeltaTime;
         if (ballSpeed > 0.01f)
         {
             transform.Translate(direction * ballSpeed);
         }
         else
         {
             timeSinceShot = 0;
             shot          = false;
             if (transform.position.y < hole.position.y)
             {
                 direction = Vector3.up;
             }
             else
             {
                 direction = Vector3.down;
             }
             force = 0f;
             club.ChangePos();
             score += 5;
             print("Score: " + score);
         }
     }
 }