Esempio n. 1
0
    //-------------------------------------------------------------------------
    //change the game difficulty
    public void changeDifficulty()//TODO: change the gem spawn rate based on the game difficulty. make the default difficulty medium, have this show when the settings are opened.
    {
        int newDifficulty = (int)difficultySlider.GetComponent <Slider>().value;

        Debug.Log("changed difficulty: " + newDifficulty);

        gameDifficulty = newDifficulty;
        switch (newDifficulty)
        {
        case 0:    //easy
            trafficManagerScript.setTimeBetweenSpawns(0.5f);
            gemSpawnRate = 0.2f;

            break;

        case 1:    //medium
            trafficManagerScript.setTimeBetweenSpawns(0.35f);
            gemSpawnRate = 0.4f;

            break;

        case 2:    //hard
            trafficManagerScript.setTimeBetweenSpawns(0.25f);
            gemSpawnRate = 0.6f;

            break;
        }
    }