Made the Random it's own Function returning a value to be used. Works!

/code
    void StartGame()
    {
        currentScreen = Screen.Password;
        Terminal.ClearScreen();
        RandomizePassword();
        switch (level)
        {
            case 1:
                password = level1Passwords[randomPassword];
                Debug.Log(randomPassword);
                break;
            case 2:
                password = level2Passwords[randomPassword];
                Debug.Log(randomPassword);
                break;
            default:
                Debug.LogError("Invalid level number");
                break;
        }
        Terminal.WriteLine("Please enter your password: ");
    }
    void PasswordCheck(string input)
    {
        if(input == password)
        {
            Terminal.WriteLine("You Are Correct.");
            currentScreen = Screen.Win;
        }
        else
        {
            Terminal.WriteLine("Guess Again...?");
            currentScreen = Screen.Password;
        }
    }
    int RandomizePassword()
    {
        randomPassword = Random.Range(0, 7);
        return randomPassword;
    }
}
2 Likes

Nice code! Looking good🙌

Privacy & Terms