My Solo Challenge

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

public class Hacker : MonoBehaviour
{
int level;
string UserPassWord;

enum Screen {MainMenu, Password, Win}
Screen currentScreen=Screen.MainMenu;

//Screen currentScreen1;
//currentScreen1 = Screen.MainMenu;


// Start is called before the first frame update
void Start()
{
    ShowTafitRashi("shalom - start playing"); 
}
void ShowTafitRashi(string dash)
{
    Terminal.ClearScreen();
    Terminal.WriteLine(dash);
    Terminal.WriteLine("Learning use the Terminal");
    Terminal.WriteLine("");
    Terminal.WriteLine("Press 1 to press 1");
    Terminal.WriteLine("Press 2 to press 2");
    Terminal.WriteLine("Press 3 to press 3");
    Terminal.WriteLine("");
    Terminal.WriteLine("Enter your choice");
}

void OnUserInput(string input)
{
    if (input == "0")
    {
        currentScreen = Screen.MainMenu;
        ShowTafitRashi("Starting over");
    }
    else if (currentScreen == Screen.MainMenu)
        RunMainMenu(input);
    else if (currentScreen == Screen.Password)
        CheckPassWord(input);
}

void RunMainMenu(string input)
{
    if (input == "1")
    {
        level = 1;
        StartGame();
    }
    else if (input == "2")
    {
        level = 2;
        StartGame();
    }

    else
    {
        Terminal.WriteLine("Please enter a valid choice");
    }
}

//Starting the game
void StartGame()

{
    Terminal.WriteLine("Your choice is: " + level);
    Terminal.WriteLine("please enter your password");
    currentScreen = Screen.Password;
}

void CheckPassWord(string UserPassWord)
{
    if (level == 1)
    {
        if (UserPassWord == "11")
            Terminal.WriteLine("Mazaltov");
        else
            Terminal.WriteLine("Wrong password for level 1");
    }
    if (level == 2)
    {
        if (UserPassWord == "22")
            Terminal.WriteLine("Mazaltov");
        else
            Terminal.WriteLine("Wrong password for level 2");
    }
}
// Update is called once per frame
void Update()
{
        
}

}

Privacy & Terms