Solo challenge

//Game State
int level;
enum Screen {MainMenu, Password, Win };
Screen currentscreen;
string userpassword;

// Use this for initialization
void Start() {
    currentscreen = Screen.MainMenu;
    ShowMainMenu("Kevin");
}

void ShowMainMenu (string User)
{
    currentscreen = Screen.MainMenu;
    Terminal.ClearScreen();
    Terminal.WriteLine("Hello " + User);
    Terminal.WriteLine("What would you like hack into?");
    Terminal.WriteLine("Press 1 for the local library");
    Terminal.WriteLine("Press 2 for the local police office");
    Terminal.WriteLine("Press 3 for the Pentagon");
    Terminal.WriteLine("Enter your selection:");
}

void OnUserInput (string input)
{
    if(input == "menu")
    {
        print("the user typed " + input);
        level = 0;
        ShowMainMenu("Kevin");
    }
    else if(currentscreen == Screen.MainMenu)
    {
        RunMainMenu(input);
    }
    else if(currentscreen == Screen.Password)
    {
        ConfirmPassword(input, userpassword);
    }

}

private void ConfirmPassword(string input, string userpassword)
{
    if(input == userpassword)
    {
        currentscreen = Screen.Win;
        Terminal.WriteLine("Thank you");
    }
    else
    {
        Terminal.WriteLine("Please Try Again");
    }
}
 
private void RunMainMenu(string input)
{
    if (input == "1")
    {
        print("the user typed " + input);
        level = 1;
        currentscreen = Screen.Password;
        userpassword = "12345";
        StartGame();
    }
    else if (input == "2")
    {
        print("the user typed " + input);
        level = 2;
        currentscreen = Screen.Password;
        userpassword = "password";
        StartGame();
    }
    else if (input == "3")
    {
        print("the user typed " + input);
        level = 3;
        currentscreen = Screen.Password;
        userpassword = "mahomes";
        StartGame();
    }
    else if (input == "420")
    {
        print("the user typed " + input);
        currentscreen = Screen.Win;
        Terminal.WriteLine("the dude abides");
    }
    else
    {
        print("the user typed " + input);
        Terminal.WriteLine("1.. 2.. or 3.. this isn't hard");
    }
}

void StartGame()
{
    print("the user typed " + level);
    Terminal.WriteLine("you chose level " + level);
    Terminal.WriteLine("please enter your password");
}

Privacy & Terms