My Terminal Hacker is ready for your feedback.. Thanks in advance

http://www.sharemygame.com/share/b3192a4f-9b74-4c66-b94e-4b5ccbe18916

Here is the code too, if needed:

using System;
using System.Collections.Generic;
using UnityEngine;
//using UnityEditor;


public class Hacker : MonoBehaviour
{
	//Game configuration data
	//string[] level1Passwords = { "uniform", "handcuffs", "badge", "horse", "dog" };
	//string[] level2Passwords = { "undercover", "federal", "investigate", "intelligence", "constitution" };
	//string[] level3Passwords = { "prisoner", "weapons", "fighter", "exploration", "camoflage" };
	Dictionary<int, string[]> _passwords = new Dictionary<int, string[]>
	{
		{ 1, new string[] { "uniform", "handcuffs", "badge", "horse", "dog","jail"} },
		{ 2, new string[] { "undercover", "federal", "investigate", "intelligence", "constitution" } },
		{ 3, new string[] { "prisoner", "weapons", "fighter", "exploration", "camoflage" } },
	};

	//Game state
	int level;
	enum Screen { MainMenu, Password, Win, Loose };
	Screen currentScreen;
	string password;
	string anagram;
	int lives;
	string lvlName = "";
	const string menuHint = "| 'menu' to go back      |";
	const string quitHint = "| 'quit' to Exit game    |";

	// Use this for initialization
	void Start()
	{
		lives = 5;
		DisplayMainMenu();

	}

	// Update is called once per frame
	void Update()
	{
		//int r = Random.Range(0, _passwords[level].Length);
		//print(r);
	}

	void DisplayMainMenu()
	{
		Terminal.ClearScreen();
		currentScreen = Screen.MainMenu;
		DisplayLives();
		//WriteBackButton();
		DisplayQuitButton();
		Terminal.WriteLine("-What would you like to hack into?");
		Terminal.WriteLine("-Press 1 to Hack the Police Station");
		Terminal.WriteLine("-Press 2 to hack the FBI headquarters");
		Terminal.WriteLine("-Press 3 to hack the Military Base");
		Terminal.WriteLine("-Enter your selection: ");
		//TouchScreenKeyboard.Open("");
	}


	void OnUserInput(string input)
	{
		if (input == "menu" || input == "Menu")
		{
			level = 0;
			DisplayMainMenu();
		}
		else if (currentScreen == Screen.MainMenu)
		{
			RunMainMenu(input);

		}
		else if (currentScreen == Screen.Password)
		{
			RunHacker(input);
		}
		else if (currentScreen == Screen.Win)
		{
			DisplayMainMenu();
		}
		else if (currentScreen == Screen.Loose)
		{
			lives = 5;
			DisplayMainMenu();
		}


	}


	void RunMainMenu(string input)
	{
		bool isValidLevel = (input == "1" || input == "2" || input == "3");
		if (isValidLevel)
		{
			level = int.Parse(input);
			AskForPassword();
		}
		else if (input == "007")
		{
			DisplayMainMenu();
			Terminal.WriteLine("Please enter a valid level Mr. Bond!");
		}
		else if (input == "quit" || input == "Quit" || input == "QUIT" || input == "close" || input =="exit")
		{
			Quit();
		}
		else
		{
			DisplayMainMenu();
			Terminal.WriteLine("Please choose a valid level!");
		}

	}



	void AskForPassword()
	{

		//System.Random rand = new System.Random();
		//int r = rand.Next(_passwords[level].Length);

		int r = UnityEngine.Random.Range(0, _passwords[level].Length);
		password = _passwords[level][r];
		Terminal.ClearScreen();
		currentScreen = Screen.Password;
		anagram = Shuffle(password);
		//anagram = password.Anagram();

		SetLevelName();

		DisplayLives();
		DisplayLevelQuestion();

	}

	void SetLevelName()
	{
		switch (level)
		{
			case 1:
				lvlName = "Police Station";
				break;
			case 2:
				lvlName = "FBI Headquarters";

				break;
			case 3:
				lvlName = "Army Base";
				break;
			default:
				Debug.LogError("Please enter a valid level:");
				break;
		}
	}

	void DisplayLives()
	{
		Terminal.WriteLine("__________________________");
		Terminal.WriteLine(GetLives());
		Terminal.WriteLine("__________________________");
	}

	void DisplayLevelQuestion()
	{
		DisplayBackButton();
		Terminal.WriteLine("<<<" + lvlName + ">>> ");
		Terminal.WriteLine("Secret Code: " + anagram);
		Terminal.WriteLine("Please enter your password: ");
	}

	void DisplayBackButton()
	{
		Terminal.WriteLine("--------------------------");
		Terminal.WriteLine(menuHint);
		Terminal.WriteLine("--------------------------");
	}

	void DisplayQuitButton()
	{
		Terminal.WriteLine("--------------------------");
		Terminal.WriteLine(quitHint);
		Terminal.WriteLine("--------------------------");
	}

	string GetLives()
	{
		//print(lives);
		string livesText = "Lives: ";
		//switch (lives){
		//	case 1:
		//		livesText = "Lives: ❤️";
		//              break;
		//	case 2:
		//		livesText = "Lives: ❤️❤️";
		//              break;
		//	case 3:
		//		livesText = "Lives: ❤❤️❤️️";
		//              break;
		//	case 4:
		//		livesText = "Lives: ❤️❤️❤️❤️";
		//              break;
		//	case 5:
		//		livesText = "Lives: ❤❤️❤️❤️❤️️";
		//              break;
		//	case 0:
		//		currentScreen = Screen.Loose;
		//		livesText = "Out of lives, GAME OVER! press Enter to retry";
		//              break;
		//	default:
		//		livesText = "Error";
		//		Debug.LogError("Debug error");
		//		break;
		//}
		string livesChar = GetLivesChar();
		for (int i = 0; i < lives; i++)
		{
			livesText += livesChar;

			//print(livesText);
		}
		return livesText;
	}

	private static string GetLivesChar()
	{
		string livesChar;
#if UNITY_IOS
        livesChar = "❤";
#elif UNITY_EDITOR
        livesChar = "❤";
#elif UNITY_STANDALONE_OSX
        livesChar = "❤";
#elif UNITY_STANDALONE_WIN
        livesChar = "❤";
#elif UNITY_WEBGL
        livesChar = "+";
#endif
        return livesChar;
	}
        

	void RunHacker(string ans)
	{
		if (ans == password)
		{
			DisplayWinScreen();
		}
		else
		{
			EnterWrongAnswer(ans);
			//AskForPassword("Oops! Wrong Password");
		}
	}

	private void EnterWrongAnswer(string answer)
	{
		if (lives > 1)
		{
			lives--;
			Terminal.ClearScreen();
			Terminal.WriteLine("oops! wrong password");
			Terminal.WriteLine("You entered: " + answer);
			DisplayLives();
			anagram = Shuffle(anagram);
			DisplayLevelQuestion();
		}
		else
		{
			DisplayLoseScreen();
		}
	}

	void DisplayWinScreen()
	{
		currentScreen = Screen.Win;
		Terminal.ClearScreen();
		DisplayLevelReward();

	}

	void DisplayLoseScreen()
	{
		currentScreen = Screen.Loose;
		Terminal.ClearScreen();
		DisplayGameOver();

	}

	void DisplayGameOver()
	{

		Terminal.WriteLine("Out of lives, GAME OVER! press Enter to retry");
		Terminal.WriteLine(@"
+-+-+-+-+ +-+-+-+-+
|G|a|m|e| |o|v|e|r|
+-+-+-+-+ +-+-+-+-+     
");
	}

	void DisplayLevelReward()
	{
		Terminal.WriteLine("Initializing system download....");
		Terminal.WriteLine("<<" + lvlName + ">>" + " hacked succesfully");
		switch (level)
		{
			case 1:
				Terminal.WriteLine(@"
    _*_ ....iiooiioo
 __/_|_\__ 
[(o)_R_(o)]          
                ");
				break;
			case 2:
				Terminal.WriteLine(@"
  __ _     _ 
 / _| |   (_)
| |_| |__  _ 
|  _| '_ \| |
| | | |_) | |
|_| |_.__/|_|         
                ");
				break;
			case 3:
				Terminal.WriteLine(@"
    ___
 __(   )====::
/~~~~~~~~~\
\O.O.O.O.O/         
                ");
				break;
		}

		Terminal.WriteLine(">>Press Enter<<");
	}

	string Shuffle(string str)
	{
		char[] array = str.ToCharArray();
		char[] stringToReturn = str.ToCharArray();
		//Random rand = new Random();
		string[] historyArray = new string[array.Length];
		int k;
		int i = 0;
		for (int n = array.Length; n > 0; n--)
		{
			k = UnityEngine.Random.Range(0, array.Length);
			if (historyArray[k] == null)
			{
				historyArray[k] = k.ToString();
				var value = array[k];
				stringToReturn[i] = value;
				i++;
			}
			else
			{
				n++;
			}

		}
		return new string(stringToReturn);
	}
        

		public void Quit()
    {
#if (UNITY_EDITOR || DEVELOPMENT_BUILD)
        Debug.Log(this.name + " : " + this.GetType() + " : " + System.Reflection.MethodBase.GetCurrentMethod().Name);
#endif
#if (UNITY_EDITOR)
        UnityEditor.EditorApplication.isPlaying = false;
#elif (UNITY_STANDALONE)
    Application.Quit();
#elif (UNITY_WEBGL)
    Application.OpenURL("about:blank");
#endif
    }

}

Privacy & Terms