If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.
To solve the password problem I used the && operator (see below Method/Function). However I prefer the way you have done it as less lines of code.
private void CheckPassword(string input)
{
if (level == 1 && input == "Password1")
{
Terminal.WriteLine("Welcome to Amazon Jeff");
}
else if (level == 2 && input == "Password2")
{
Terminal.WriteLine("Welcome to Google Sundar");
}
else if (level == 3 && input == "Password3")
{
Terminal.WriteLine("Welcome to Microsoft Bill");
}
else
{
Terminal.WriteLine("Incorrect Password Entered !!");
}
}
After I deleted the Library folder, when I reopened Unity I had to recreate the Scene, because it said it was an untitled scene. I had everything closed before I did that, so I’m not sure why it happened, just wanted to warn you for when you’re recommending to people that they delete that folder.
I used the same approach (checking level && input three times) - and found it necessary to insert another method to get the password input - and also had to check when each level and password input did not match… I knew there must be simpler solution!
I had a similar issue on windows. There were two fixes:
- Restore the library folder from Recycle or
- Open the script and it asked to fix my code due to inconsistencies. Letting the automatic fix happened seemed to fix it.
Lol, I was like (after 3 hours) I need to continue with this. I felt like I kept getting so close, but was actually over complicating it and trying to create extra methods. It was surely worth the time though, I was getting some interesting results and debugging a lot of things to see when and where things were happening. I came really far from where and what it looked like after the first half hour. I also had to incorporate that handy clear screen because I have too much text going on, but it flows much better when for me with freeing up that space.
When I continued and saw how simple it was when you had implemented it, I was just like, looll ::face palm:: I am glad I spent the time trying though
I really like this section of the course, but I think I got a little carried away, before I knew, I had created (or completed) a basic version of the game…
For those interested, my version of the Terminal Hacker game, is up on github at Terminal Hacker Github Link.
Any feedback is very welcome.
Hi, i used exact the same thing as you! Nice!
Regards!