DemoControl.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        if (setupGUI.enabled)
        {
            if (setupGUI.Verified)
            {
                setupGUI.enabled = false;
                menuGUI.enabled = true;
            }
            else
            {
                menuGUI.enabled = false;
                return;
            }
        }

        // Handle pause and unpause/menu-exit keys //

        if (Time.timeScale == 0.0f)
        {
            if (Input.GetKeyDown ("joystick button 3"))
            {
                Time.timeScale = 1.0f;
            }
        }
        else
        {
            timeSpent += Time.deltaTime;

            if (Input.GetKeyDown (KeyCode.Return) || Input.GetKeyDown (KeyCode.Menu) || (Time.timeScale > 0.0f && !XperiaInput.KeypadAvailable))
            {
                Time.timeScale = 0.0f;
            }
        }

        if (Input.GetKeyDown (KeyCode.Escape))
        // Hard quit on the back button
        {
            Application.Quit ();
        }

        audio.enabled = PlayerPrefs.GetInt ("Play audio", 1) != 0;
            // Enable/disable audio dependent on player prefs setting toggled elsewhere

        if (TimeLeft <= 0)
        // Set score and load highscore on timer end
        {
            PlayerPrefs.SetInt ("Last score", player.Points);
            Application.LoadLevel ("Endgame");
        }

        // Flip game and menu/credits GUI based on game pause state //

        gameGUI.enabled = Time.timeScale > 0.0f;
        creditsGUI.enabled = menuGUI.enabled = !gameGUI.enabled;
    }