The Hacker gets attacked! - Terminal Layout

Took my Boot/menu design a bit further as I’m not a beginner but not an expert either ^^. My code is below (simpel)

    bool boot = true;
    int stage = 0;
    bool menu = false;
    // Use this for initialization
    void Start () {
        InvokeRepeating("startProcess", 0.5f, 2f);
    }

    void startProcess()
    {
        if (boot == true)
        {
            switch (stage)
            {
                case 0:
                    Terminal.ClearScreen();
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("       Booting Hacking Terminal");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("                0%");
                    Terminal.WriteLine("[                                    ]");
                    break;
                case 1:
                    Terminal.ClearScreen();
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("       Booting Hacking Terminal");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("                25%");
                    Terminal.WriteLine("[---------                           ]");
                    break;
                case 2:
                    Terminal.ClearScreen();
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("       Booting Hacking Terminal");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("                50%");
                    Terminal.WriteLine("[------------------                  ]");
                    break;
                case 3:
                    Terminal.ClearScreen();
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("       Booting Hacking Terminal");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("                75%");
                    Terminal.WriteLine("[---------------------------         ]");
                    break;
                case 5:
                    Terminal.ClearScreen();
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("          Sucessfully Booted!");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("                100%");
                    Terminal.WriteLine("[------------------------------------]");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("       Detected a cyber Attack!");
                    break;
                case 6:
                    Terminal.ClearScreen();
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("");
                    Terminal.WriteLine("       Initialising cyber defense!");
                    Terminal.WriteLine("       ");
                    Terminal.WriteLine("       Protocol Alpha activated!");
                    Terminal.WriteLine("");
                    boot = false;
                    break;
            }
            stage++;
            if(boot == false)
                menu = true;
        } else if (menu == true){ 
        Terminal.ClearScreen();
        Terminal.WriteLine("Protocol Alpha Status:      active");
        Terminal.WriteLine("");
        Terminal.WriteLine("Press 1 to shutdown the local network [EASY]");
        Terminal.WriteLine("Press 2 to block the compromised part of your network [MEDIUM]");
        Terminal.WriteLine("Press 3 to counterattack [HARD]");
        Terminal.WriteLine("");
        Terminal.WriteLine("Choose your Action!");
        }
    }
6 Likes

I like that code and what it makes the boot screen look like. What would you use if you wanted to introduce a 2 second message before sending the user to the main menu?

1 Like

Hey Matt,

as far as I know you could send a Message “Terminal.WriteLine(“YOUR MESSAGE”);” and after that invoke your Function to create the Main Menu after 2 seconds with Invoke(“FUNCTIONNAME”, 2) // 2 = time in seconds. (I haven’t tested it yet)

The Doc for it can be found here
https://docs.unity3d.com/ScriptReference/MonoBehaviour.Invoke.html

Best Regards,

Baris

1 Like

Fantastic, thank you SuReLLi! I’ll give that a try, as I wanted to provide an error prior to sending them back to retry the password.

No problem :smiley: Happy that i could be of help and I wish you happy coding.

It feels like marching through mud, but I’ll keep going… :slight_smile:

Yeah, I guess it feels that way for everyone, but once you got used to it it is a lot of fun as you can create alot of different programs :smiley:

I’m looking forward to breaking through to proficiency. Appreciate the encouragement! :slight_smile:

1 Like

That looks absolutely incredible!!! I love the look. Plus your code just helped me with a block I was having. Thank you!!!

Funny, guys, very funny. But it’s not amusing when you have an actual hacker attack. I had, and it was a nightmare 'cause damage was irreversible for the family business. And husband call to solutions4it.co.uk to find out what happened and what we should do. So, yeah, good when you know this trick and know what to do, but ordinary people have problems with your IT humor. If you know how to do this thing, may you also explain what people ought to do in this issue? Thanks in advance, clever guys.

Privacy & Terms