Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (levelRestart)
        {
            startingPanel.SetActive(true);
            GameStartCanvas.SetActive(false);
            EntireGame.SetActive(false);
        }
        levelTime     -= Time.deltaTime;
        timeText.text  = Mathf.RoundToInt(levelTime).ToString();
        scoreText.text = score + " / " + targetScore;
        coinsText.text = tempCoinCount.ToString();
        if (tempCoinCount < money)
        {
            if (!IsInvoking("IncrementTemporaryCoins"))
            {
                coinsText.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
                InvokeRepeating("IncrementTemporaryCoins", 0f, timeBetweenCoinIncrement);
            }
        }
        if (levelTime <= 0)
        {
            GameOver();
        }

        //cannot go over a minute
        if (levelTime > 60)
        {
            levelTime = 60;
        }
    }
Esempio n. 2
0
 public void StartGame()
 {
     paused         = false;
     Time.timeScale = 1;
     startingPanel.SetActive(false);
     GameStartCanvas.SetActive(true);
     EntireGame.SetActive(true);
     gp = GameObject.FindObjectOfType <GeneratePassenger> ();
     gp.CreatePassenger();
 }