Array of arrays for passwords

Here is my code so far. I have gone with a single “array of arrays” for passwords.
I still need to add a hint (i.e. anagram of randomised password). Also, I am now thinking of changing my password array to a “levels” array, where each element represents a level and each level element contains not only the passwords but also a welcome message. This way I can Terminal.WriteLine a welcome message or something else to signal which item from the Main Menu I chose.

using UnityEngine;

public class Hacker : MonoBehaviour
{
    //Game State
    int level;
    enum Screen { MainMenu, Password, Win }
    Screen currentScreen;
    [SerializeField] string[][] passwords = {
        new string[]{ "assemble", "bottle", "cap", "liquid", "drink" },
        new string[]{ "cleaning", "vacuum", "duster", "polish", "casserole" },
        new string[]{ "mutilate", "recon", "superior", "terrorist", "missiles"}
    };
    
	// Use this for initialization
	void Start ()
    {
        ShowMainMenu();
    }

    void ShowMainMenu()
    {
        currentScreen = Screen.MainMenu;
        Terminal.ClearScreen();
        Terminal.WriteLine("RoboMaster Corp. Language Correction");
        Terminal.WriteLine("------------------------------");
        Terminal.WriteLine("Language malfunctions found.");
        Terminal.WriteLine("Which Robot would you like to assess");
        Terminal.WriteLine("");
        Terminal.WriteLine("Press 1 for Bottlecap Betsy 2000");
        Terminal.WriteLine("Press 2 for MegaMaid DM1432");
        Terminal.WriteLine("Press 3 for Battlechief Cyborg X5");
        Terminal.WriteLine("");
        Terminal.WriteLine("Enter your selection now:");
    }

    void OnUserInput(string input)
    {
        if (input == "menu")
        {
            ShowMainMenu();
        }
        else if (currentScreen == Screen.MainMenu)
        {
            RunMainMenu(input);
        }
        else if (currentScreen == Screen.Password)
        {
            GuessPassword(input);
        }
        else if (currentScreen == Screen.Win)
        {
            ShowMainMenu();
        }
    }

    void RunMainMenu(string input)
    {
        switch (input)
        {
            case "1":
            case "2":
            case "3":
                StartGame(int.Parse(input));
                break;
            case "007": //Easter Egg
                Terminal.WriteLine("Please choose a level, Mr. Bond");
                break;
            default:
                Terminal.WriteLine("Invalid Input, please try again");
                break;
        }
    }

    void StartGame(int level)
    {
        currentScreen = Screen.Password;
        this.level = level;

        Terminal.WriteLine("Enter the password for level " + level);
    }

    void GuessPassword (string guess)
    {
        int rng = UnityEngine.Random.Range(0, passwords[level - 1].Length);
        string randomPassword = passwords[level - 1][rng];

        Terminal.ClearScreen();

        //TODO Generate and display anagram

        if (guess == randomPassword)
        {
            Win();
        }
        else
        {
            Terminal.WriteLine("Wrong. Try again!");
        }
    }

    void Win()
    {
        currentScreen = Screen.Win;
        Terminal.WriteLine("Correct. Well Done");
        Terminal.WriteLine("Enter your name to record your awesomeness and return to the main menu"); // Only provides a trigger to return to main menu
    }
}

Privacy & Terms