Exemple #1
0
 // Display starting screen with rotating camera
 void Update()
 {
     if (!started)
     {
         if (Input.anyKey)
         {
             started = true;
             SpawnBall();
         }
         else
         {
             // Rotate camera around starting position of the ball
             m_Camera.transform.RotateAround(m_Ball.m_StartingPosition.position, Vector3.up, 20 * Time.deltaTime);
             m_Camera.transform.LookAt(m_Ball.m_StartingPosition);
         }
     }
     else
     {
         // Pause menu
         if (Input.GetButtonDown("Submit"))
         {
             running        = 1 - running;
             Time.timeScale = running;
             if (running == 0)
             {
                 // Pause background music
                 audioSource.Pause();
                 // Disable control on the ball
                 m_Ball.EnableBall(false);
                 uidisplay.DisplayPauseMenu();
             }
             else
             {
                 uidisplay.Resume();
                 // Reenable control on the ball
                 m_Ball.EnableBall(true);
                 // Resume background music
                 audioSource.Play();
             }
         }
     }
 }