Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Hacker : MonoBehaviour
- {
- // Game config
- string[] level1passwords = { "friend", "neighbor", "home", "password", "123", "qwerty" };
- string[] level2passwords = { "police", "law", "squadcar", "sergeant", "tazer", "donut" };
- string[] level3passwords = { "federal", "machinegun", "fbiopenup", "feds", "prison", "trouble" };
- // Game state
- int level;
- int CrackAttempts;
- enum Screen { MainMenu, Password, Win, EasterEgg };
- Screen currentScreen = Screen.MainMenu;
- string password;
- // Start is called before the first frame update
- void Start()
- {
- ShowMainMenu();
- }
- void ShowMainMenu()
- {
- Terminal.ClearScreen();
- Terminal.WriteLine("What would you like to hack into?");
- Terminal.WriteLine(" ");
- Terminal.WriteLine("Press 1 for your neighbors wifi.");
- Terminal.WriteLine("Press 2 for the local police station.");
- Terminal.WriteLine("Press 3 for the FBI.");
- Terminal.WriteLine(" ");
- Terminal.WriteLine("Please enter your selection:");
- currentScreen = Screen.MainMenu;
- }
- void OnUserInput (string input)
- {
- bool isValidLevelNumber = (input == "1" || input == "2" || input == "3");
- if (isValidLevelNumber)
- {
- level = int.Parse(input);
- StartGame();
- }
- if (input == "Menu")
- {
- ShowMainMenu();
- currentScreen = Screen.MainMenu;
- }
- else if (input == "Method0901")
- {
- Terminal.WriteLine("Follow Method0901 on twitch: twitch.tv/METHOD0901");
- currentScreen = Screen.EasterEgg;
- }
- else if (currentScreen == Screen.Password)
- {
- Password();
- }
- else
- {
- Terminal.WriteLine("Please make a valid selection.");
- }
- void StartGame ()
- {
- Terminal.ClearScreen();
- Terminal.WriteLine("You have chosen level " + level);
- Terminal.WriteLine(" ");
- Terminal.WriteLine("Input 'Menu' or a new level number to");
- Terminal.WriteLine("choose another level.");
- Terminal.WriteLine("Please enter the password:");
- currentScreen = Screen.Password;
- }
- switch (level)
- {
- case 1:
- password = level1passwords[3];
- level = 1;
- break;
- case 2:
- password = level2passwords[5];
- level = 2;
- break;
- case 3:
- password = level3passwords[2];
- level = 3;
- break;
- }
- void Password()
- {
- if (input == password)
- {
- Terminal.WriteLine("Password successfully cracked.");
- }
- else
- {
- Terminal.WriteLine(" ");
- Terminal.WriteLine("Password incorrect.");
- CrackAttempts += 1;
- Terminal.WriteLine("Failed cracking attempts: " + CrackAttempts);
- Terminal.WriteLine("Try again:");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement