i dont know what im doing wrong, pls check my code:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class TextController : MonoBehaviour {
public Text text;
private enum States {Cell, Lock1, Sheets1, MirrorWall, MirrorHand,Sheets2, Lock2, Hall1, Stairs, Closet1, Floor1, Hall2, Closet2, InCloset, InCloset2, Hall4, Stairs2, Guard, Wall, Freedom, OverWall, UnderWall, Freedom2, Stab};
private States myState;
// Use this for initialization
void Start () {
text.text = "Press Space to Start";
myState = States.Cell
}
// Update is called once per frame
void Update () {
print (myState);
if (myState == States.Cell) {
State_Cell ();
} else if (myState == States.Lock1) {
State_Lock1 ();
} else if (myState == States.Sheets1) {
State_Sheets1 ();
} else if (myState == States.MirrorWall) {
State_MirrorWall ();
} else if (myState == States.MirrorHand) {
State_MirrorHand ();
} else if (myState == States.Sheets2) {
State_Sheets2 ();
} else if (myState == States. Lock2) {
State_Lock2 ();
} else if (myState == States.Sheets2) {
State_Sheets2 ();
} else if (myState == States.Hall1) {
State_Hall1 ();
} else if (myState == States.Stairs) {
State_Stairs();
} else if (myState == States.Closet1) {
State_Closet1 ();
} else if (myState == States.Sheets2) {
State_Sheets2 ();
} else if (myState == States.Floor1) {
State_Floor1 ();
} else if (myState == States.Hall2) {
State_Hall2 ();
} else if (myState == States.Closet2) {
State_Closet2 ();
} else if (myState == States.InCloset) {
State_InCloset ();
} else if (myState == States.InCloset2) {
State_InCloset2 ();
} else if (myState == States.Stairs2) {
State_Stairs2 ();
} else if (myState == States.Guard) {
State_Guard ();
} else if (myState == States.Wall) {
State_Wall ();
} else if (myState == States.Freedom) {
State_Freedom ();
} else if (myState == States.OverWall) {
State_OverWall ();
} else if (myState == States.UnderWall) {
State_UnderWall ();
} else if (myState == States.Stab) {
State_Stab ();
}
}
void State_Cell () {
text.text = "Your in a prison cell, your enemies have captured you, you want to meet with your group again. " +
"There are dirty sheets on the bed, a mirror on the wall, the door is locked from the outside. \n\n" +
"S to view Sheets. M to view Mirror. L to view Lock.";
if (Input.GetKeyDown(KeyCode.S)) {
myState = States.Sheets1;
}
if (Input.GetKeyDown(KeyCode.M)) {
myState = States.MirrorWall;
}
if (Input.GetKeyDown(KeyCode.L)) {
myState = States.Lock1;
}
}
void State_Sheets1 () {
text.text = "You look at the rags, they were matted with stains and dirt. Your Enemies really hate you. \n\n" +
"G to go back.";
if (Input.GetKeyDown(KeyCode.G)) {
myState = States.Cell;
}
}
void State_MirrorWall () {
text.text = "You look at the mirror. It's you!. \n\n" +
"T to take the mirror. G to go back.";
if (Input.GetKeyDown(KeyCode.G)) {
myState = States.Cell;
}
if (Input.GetKeyDown(KeyCode.T)) {
myState = States.MirrorHand;
}
}
void State_Lock1 () {
text.text = "You look at the lock, it's made of steel. \n\n" +
"G to go back.";
if (Input.GetKeyDown (KeyCode.G)) {
myState = States.Cell;
}
}
void State_MirrorHand () {
text.text = "You have the mirror at hand. \n\n" +
"S to look at the sheets. T to stab yourself. L to look at the lock";
if (Input.GetKeyDown(KeyCode.S)) {
myState = States.Cell;
}
if (Input.GetKeyDown(KeyCode.T)) {
myState = States.Stab;
}
if (Input.GetKeyDown(KeyCode.L)) {
myState = States.Lock2;
}
}
void State_Stab () {
text.text = "Good Job! You killed yourself. \n\n" +
"P to play again.";
if (Input.GetKeyDown (KeyCode.P)) {
myState = States.Cell;
}
}
void State_Sheets2 () {
text.text = "You look at the rags, while holding a mirror. nothing much. \n\n" +
"G to view Sheets.";
if (Input.GetKeyDown(KeyCode.G)) {
myState = States.MirrorHand
}
}
void State_Lock2 () {
text.text = "It's a lock. \n\n" +
"O to use the mirror to pick lock. G to go back.";
if (Input.GetKeyDown(KeyCode.G)) {
myState = States.MirrorHand;
}
if (Input.GetKeyDown(KeyCode.O)) {
myState = States.Hall1;
}
}
void State_Hall1 () {
text.text = "Your Free! Well, kinda, you still have to get out of prison. \n\n" +
"S for Stairs. C for Closet. F for Floor";
if (Input.GetKeyDown(KeyCode.S)) {
myState = States.Stairs;
}
if (Input.GetKeyDown(KeyCode.C)) {
myState = States.Closet1;
}
if (Input.GetKeyDown(KeyCode.F)) {
myState = States.Floor1;
}
}
void State_Stairs () {
text.text = "You walk out through the stairs. A guard sees you then shoots you. END. \n\n" +
"P to play again.";
if (Input.GetKeyDown (KeyCode.P)) {
myState = States.Cell;
}
}
void State_Closet1 () {
text.text = "You go to the Closet, it's locked. \n\n" +
"G to go back.";
if (Input.GetKeyDown (KeyCode.P)) {
myState = States.Hall1;
}
}
void State_Floor1 () {
text.text = "You look at the floor, there's a paperclip. \n\n" +
"G to go back. T to take Paperclip";
if (Input.GetKeyDown (KeyCode.G)) {
myState = States.Hall1;
}
if (Input.GetKeyDown (KeyCode.T)) {
myState = States.Hall2;
}
}
void State_Hall2 () {
text.text = "You now have a paperclip. \n\n" +
"S for Stairs. C for Closet.";
if (Input.GetKeyDown(KeyCode.S)) {
myState = States.Stairs;
}
if (Input.GetKeyDown(KeyCode.C)) {
myState = States.Closet2;
}
}
void State_Closet2 () {
text.text = "You look at a 12 year old, dark acacia door. \n\n" +
"O to open it. G to go back.";
if (Input.GetKeyDown(KeyCode.O)) {
myState = States.InCloset;
}
if (Input.GetKeyDown(KeyCode.G)) {
myState = States.Hall2;
}
}
void State_InCloset () {
text.text = "You are in a closet.you see a Janitor's outfit \n\n" +
"J to use outfit.";
if (Input.GetKeyDown(KeyCode.J)) {
myState = States.InCloset2;
}
}
void State_InCloset2 () {
text.text = "You are now wearing the Janitor's uniform. \n\n" +
"H to go to hall.";
if (Input.GetKeyDown(KeyCode.H)) {
myState = States.Hall4;
}
}
void State_Hall4 () {
text.text = "You are now wearing the Janitor's uniform in a hall. \n\n" +
"S to go to Stairs. G to go back.";
if (Input.GetKeyDown(KeyCode.S)) {
myState = States.Stairs2;
}
if (Input.GetKeyDown(KeyCode.G)) {
myState = States.InCloset2;
}
}
void State_Stairs2 () {
text.text = "You are now in a field. \n\n" +
"W to walk.";
if (Input.GetKeyDown(KeyCode.W)) {
myState = States.Guard;
}
}
void State_Guard () {
text.text = "A guard sees you.'What are you doing here? it's not cleaning day! you wanna go home? \n\n" +
"R to RUN. F to agree.";
if (Input.GetKeyDown(KeyCode.F)) {
myState = States.Freedom;
}
if (Input.GetKeyDown(KeyCode.R)) {
myState = States.Wall;
}
}
void State_Freedom () {
text.text = "FREEDOM. you win! \n\n" +
"P to play again.";
if (Input.GetKeyDown(KeyCode.P)) {
myState = States.Cell;
}
}
void State_Wall () {
text.text = "You run and run with the guard in pursuit. you run into a wall and theres a hole. \n\n" +
"O to go over the wall. U to go under";
if (Input.GetKeyDown(KeyCode.O)) {
myState = States.OverWall;
}
if (Input.GetKeyDown(KeyCode.U)) {
myState = States.UnderWall;
}
}
void State_OverWall () {
text.text = "You jump and hit the 20 feet tall, concrete wall \n\n" +
"P to play again.";
if (Input.GetKeyDown(KeyCode.P)) {
myState = States.Cell;
}
}
void State_UnderWall () {
text.text = "You go to the hole and climbed through, the guard stopped chasing you. you run and eventually a car passed by. It was your friends! \n\n" +
"P to play again.";
if (Input.GetKeyDown (KeyCode.P)) {
myState = States.Cell;
}
}
}