Ejemplo n.º 1
0
    private void Update()
    {
        if (!_paused)
        {
            if (_resultTimer <= 0f)
            {
                _gameTimer += Time.deltaTime;
                if (_gameTimer >= _levelDuration)
                {
                    // End of round
                    _resultTimer = Time.deltaTime;
                    txt_finalScore.GetComponent <Text>().text = "Final Score: " + _score.ToString();
                    txt_finalScore.SetActive(true);
                }
            }
        }

        if (_resultTimer > 0f)
        {
            _resultTimer += Time.deltaTime;
            if (_resultTimer >= _resultDuration)
            {
                // Back to main menu
                guiScript.ButtonYes();
            }
        }

        // Setting score, very hacky, I know :(
        txt_score.GetComponent <Text>().text = "Score: " + _score.ToString();
        txt_timer.GetComponent <Text>().text = "Timer: " + ((int)((_levelDuration - _gameTimer))).ToString();
    }