using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class TextController : MonoBehaviour {
public Text text;
private enum States {cell, mirror, sheets_0, lock_0, cell_mirror, sheets_1, lock_1, freedom};
private States myState;
// Use this for initialization
void Start () {
myState = States.cell;
}
// Update is called once per frame
void Update () {
print (myState);
if (myState == States.cell) {
state_cell();
} else if (myState == States.sheets_0) {
state_sheets_0();
} else if (myState == States.lock_0) {
state_lock_0();
}
void state_cell () {
text.text = "You are in prison, you must escape, the door is locked, no windows no holes in the ground, " +
"Only a bed with dirty sheets, some kind of lock and a dirty mirror, what will you do?\n\n" +
"Press S to view Sheets, M to view Mirror, L to view Lock" ;
if (Input.GetKeyDown(KeyCode.S)) {myState = States.sheets_0;}
else if (Input.GetKeyDown(KeyCode.L)) {myState = States.lock_0;}
}
void state_sheets_0 () {
text.text = "You cant believe you sleep in those things, Its time someone changed them " +
"the pleasure of prison life, I guess!\n\n" +
"Press R to return to roaming in your cell" ;
if (Input.GetKeyDown(KeyCode.R)) {myState = States.cell;}
}
void state_lock_0 () {
text.text = "You are in prison, you must escape, the door is locked, no windows no holes in the ground, " +
"Only a bed with dirty sheets, some kind of lock and a dirty mirror, what will you do?\n\n" +
"Press S to view Sheets, M to view Mirror, L to view Lock" ;
if (Input.GetKeyDown(KeyCode.R)) {myState = States.cell;}
}
}
Its not letting me start the game any more, when it did the l letter didn’t switch states