I don’t see any syntax that would cause “menu” to not change greeting back to "Hello " in that first condition… in fact menu isn’t resolving to true in that first condition no matter what the code is… am I overlooking an error in my code?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Hacker : MonoBehaviour
{
// Variables
string greeting = "Hello ";
string NameToSend = "Heath";
// Code
void Start()
{
ShowMainMenu(NameToSend);
}
void ShowMainMenu(string NameToUse)
{
Terminal.ClearScreen();
Terminal.WriteLine(greeting + NameToUse);
Terminal.WriteLine(" ");
Terminal.WriteLine("How would you like to proceed?");
Terminal.WriteLine(" ");
Terminal.WriteLine("1. easy peasey");
Terminal.WriteLine("2. I'm going to jail");
Terminal.WriteLine(" ");
Terminal.WriteLine("Enter your selection:");
}
void OnUserInput(string input)
{
if (input == "menu")
{
greeting = "Hello ";
ShowMainMenu(NameToSend);
}
if (input == "1")
{
Terminal.WriteLine("You chose lvl 1...");
}
else if (input == "2")
{
Terminal.WriteLine("You chose lvl 2...");
}
else if (input == "007")
{
NameToSend = "Mr. Bond";
Terminal.WriteLine("You have a license to kill...");
}
else
{
greeting = "Please make a vaild choice ";
ShowMainMenu(NameToSend);
}
}
}