Challange

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Hacker : MonoBehaviour
{

int level;
string password;
enum Screen {MainMenu, Password, Win };
Screen currentScreen = Screen.MainMenu;


// Start is called before the first frame update
void Start()
{
    ShowMainMenu();
}


void ShowMainMenu()
{
    currentScreen = Screen.MainMenu;
    Terminal.ClearScreen();
    Terminal.WriteLine("What would you like to hack into?");
    Terminal.WriteLine("Press 1 for the FBI");
    Terminal.WriteLine("Press 2 for the EURO JACKPOT");
    Terminal.WriteLine("Press 3 for the NASA");
    Terminal.WriteLine("Enter your selection: ");
}

void OnUserInput(string input)
{
    if(input == "menu")
    {
        level = 0; 
        ShowMainMenu();
    }

    else if (currentScreen == Screen.MainMenu)
    {
        RunMainMenu(input);
    }

    else if(currentScreen == Screen.Password)
    {
        Password(input);
    }
    

}

void RunMainMenu(string input)
{

    if (input == "hello")
    {
        Terminal.WriteLine("Nice to meet you");
    }
    else if (input == "1")
    {
        level = 1;
        password = "halloween";
        StartGame();
    }
    else if (input == "2")
    {
        level = 2;
        password = "bornholm";
        StartGame();
    }
    else if (input == "3")
    {
        level = 3;
        password = "fiveciastek";
        StartGame();
    }
    else if (input == "why not")
    {
        Terminal.WriteLine("because");
    }
    else
    {
        Terminal.WriteLine("Wrong choose, try again later");
    }
}

void StartGame()
{
    currentScreen = Screen.Password;
    Terminal.WriteLine("You have chosen level: " + level);
    Terminal.WriteLine("Please enter your password: ");

}



void Password(string input)
{
    if (input == password)
    {
        Terminal.WriteLine("Congratulations you are in");
        Terminal.WriteLine("All data is yours :)");
    }
    else
    {
        Terminal.WriteLine("Sorry wrong password. Please try again");

    }
}

}

Privacy & Terms