void OnEnable()
    {
        int difficulty = PlayerPrefs.GetInt("difficulty");

        switch (difficulty)
        {
        case 0:
            this.difficulty = DifficultyUtility.Difficulty.EASY;
            break;

        case 1:
            this.difficulty = DifficultyUtility.Difficulty.MEDIUM;
            break;

        case 2:
            this.difficulty = DifficultyUtility.Difficulty.HARD;
            break;

        default:
            Application.Quit();
            return;
        }
        if (this.difficulty == DifficultyUtility.Difficulty.MEDIUM)
        {
            this.goodScore *= 2;
            this.badScore  *= 2;
        }
        else if (this.difficulty == DifficultyUtility.Difficulty.HARD)
        {
            this.goodScore *= 4;
            this.badScore  *= 4;
        }
    }
Beispiel #2
0
    void OnEnable()
    {
        // PlayerPrefs is the preferred way to pass (simple) data between scenes
        // https://docs.unity3d.com/ScriptReference/PlayerPrefs.html
        int difficulty = PlayerPrefs.GetInt("difficulty");

        switch (difficulty)
        {
        case 0:
            this.difficulty = DifficultyUtility.Difficulty.EASY;
            break;

        case 1:
            this.difficulty = DifficultyUtility.Difficulty.MEDIUM;
            break;

        case 2:
            this.difficulty = DifficultyUtility.Difficulty.HARD;
            break;

        default:
            Application.Quit();
            return;
        }
    }
Beispiel #3
0
    private void loadPlayScene(DifficultyUtility.Difficulty chosen)
    {
        // PlayerPrefs is the preferred way to pass (simple) data between scenes
        // https://docs.unity3d.com/ScriptReference/PlayerPrefs.html
        switch (chosen)
        {
        case DifficultyUtility.Difficulty.EASY:
            PlayerPrefs.SetInt("difficulty", 0);
            break;

        case DifficultyUtility.Difficulty.MEDIUM:
            PlayerPrefs.SetInt("difficulty", 1);
            break;

        case DifficultyUtility.Difficulty.HARD:
            PlayerPrefs.SetInt("difficulty", 2);
            break;

        default:
            PlayerPrefs.SetInt("difficulty", 0);
            break;
        }
        // https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html
        SceneManager.LoadSceneAsync("Game");
    }
Beispiel #4
0
 private string generateGoodPassword(DifficultyUtility.Difficulty diff)
 {
     if (diff == DifficultyUtility.Difficulty.EASY)
     {
         return(this.getRandFromList(this.easyGoodPasswords));
     }
     else if (diff == DifficultyUtility.Difficulty.MEDIUM)
     {
         return(this.getRandFromList(this.mediumGoodPasswords));
     }
     else
     {
         return(this.getRandFromList(this.hardGoodPasswords));
     }
 }