After a bit of work, I was able to get a solution that seemed at least somewhat elegant. The first version that passed was considerably worse with lots of repeated code.
When currentScreen == Screen.Pass
the following function is called.
Feedback welcome!
Edit: Saw the rest of the lesson. What do you folks think? B+ effort?
void PasswordInput(string input) {
int passCheck=0;
if (level == 1) {
if (input == "cafe") {
passCheck = 1;
}
}
else if (level == 2) {
if (input == "hospital") {
passCheck = 1;
}
}
else if (level == 3) {
if (input == "space") {
passCheck = 1;
}
}
if (passCheck == 1) {
Terminal.WriteLine("Password Accepted");
}
else {
Terminal.WriteLine("Wrong Password: Try again or [reboot]");
}
}