Current Screen Issue

Hi,

Below is my script which i am trying to execute, Only differences from Ben’s script to mine is that i have used string variable for defining Game Level.

Apart from that enum are all correctly defined but when i execute via unity the variable Screen Name changes but still it stick to main menu screen which doesn’t make sense

Can you please guide how do i resolve this issue ?

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

public class Hacker : MonoBehaviour
{
string mode;
enum Screen{ MainMenu, Password, Win};
Screen currentScreen = Screen.MainMenu;

// Start is called before the first frame update
void Start()    
{
    ShowMainMenu("Nithin"+",");
   
}
void ShowMainMenu(string name) {
    Terminal.ClearScreen();
    string Greetings = (name);
    Terminal.WriteLine(Greetings);
    Terminal.WriteLine("What would you like to hack?");
    Terminal.WriteLine("Choose Difficulty Level:");
    Terminal.WriteLine("Easy - Wife's Account");
    Terminal.WriteLine("Medium - Police Station Files");
    Terminal.WriteLine("Hard - NSA Records");
    Terminal.WriteLine("Enter your selection with 'E'/'M'/'H'");
}
void OnUserInput(string input)
{
    if (input == "E")
    {
        mode = "Easy";
        StartGame(mode);
    }
    else if(input == "M")
    {
        mode = "Medium";
        StartGame(mode);
    }
    else if(input == "H")
    {
        mode = "Hard";
        StartGame(mode);
    }
    else if(input == "007")
    {
        Terminal.WriteLine("Choose the right option Bond");
    }
    else if(input == "Menu")
    {
        ShowMainMenu("Hello Screen Cleared Enter your Game Mode");
    }
    else
    {
        Terminal.WriteLine("Choose valid Game Mode");
    }
            
}

void StartGame(string mode)
{
    currentScreen = Screen.Password;
    Terminal.WriteLine("User has choosen " +  mode +" "+"mode");
    Terminal.WriteLine("Enter The Password:");
}

}

Below are screenshot of unity

I have the same issue with Ben’s Code as well as i tried to copy from GitHub.

The screen variable changes but the actual game screen points to “Choose Valid Game Mode” message. Not sure what i am doing wrong here.

Privacy & Terms