I have made a game that has two panels, one with a textbox and one with an input field. Then i have this script that makes the thing you write in the input field being displayed in the textbox. Here it is:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
public class TextInput : MonoBehaviour
{
InputField input;
InputField.SubmitEvent se;
public Text output;
void Start()
{
input = gameObject.GetComponent<InputField>();
se = new InputField.SubmitEvent();
se.AddListener(SubmitInput);
input.onEndEdit = se;
}
private void SubmitInput(string whatyoutype)
{
string currentText = output.text;
string newText = currentText + "
" + “>” + whatyoutype;
output.text = newText;
input.text = “”;
input.ActivateInputField();
string west = currentText + "
" + “>” + “To the west is a forest”;
string north = currentText + "
" + “>” + “To the north is a road”;
if (whatyoutype == "West")
{
output.text = west;
}
}
}
As you can see, if you write “West” in the input field, the output in the textbox would be a string called west, that displays the text “To the west is a forest”.
My Question is this: How could you do it so that if the string is west (in other words if you have written “West”) and you then write “North” the string would become north (the one that displays the words “To the north is a road”) but ONLY if the string had already been west, in other words you can only access north if west already had been used?