IEnumerator StartTheGame()
    {
        inGameUI.alpha = 1f;
        nextWave.alpha = 0f;
        gameOver.alpha = 0f;

        rocketColumn = 0;

        if (PlayerPrefs.HasKey("currentRound"))
        {
            currentRound = PlayerPrefs.GetInt("currentRound", 1);
            if (currentRound == 6)
            {
                currentRound = 1;
            }
        }

        startRound.SetWaveNumber(currentRound);
        startRound.ToggleVisible();

        livesController.UpdateLives(numLives);

        gameBoard.Clear();
        gameBoard.SetValueAt(rocketColumn, 5, true);

        yield return(new WaitForSeconds(gameStartDelay));

        startRound.ToggleVisible(false);

        isRunning = true;
        pianola.StartPianola();
    }
Esempio n. 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            if (livesController.lives > 0)
            {
                livesController.lives -= 1;
                //Set sluzy w celu zapmietania
                PlayerPrefs.SetInt("lives", livesController.lives);
                livesController.UpdateLives();
                StartCoroutine(BeginStart());
            }
            else
            {
                panelGameOver.SetActive(true);
                livesController.ResetLives();

                StartCoroutine(BeginStart());
            }
        }

        IEnumerator BeginStart()
        {
            yield return(new WaitForSeconds(3f));

            SceneManager.LoadScene(0);
        }
    }