I just realized I didn’t even really need that line of code anyways (at least up there). However, still doesn’t work. Thank you for the tip of posting the code here! Here’s the code. This is driving me mad!
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class TextController : MonoBehaviour {
public Text text;
// Use this for initialization
private enum States {courtroom_1, objection, courtroom_2, g_court, b_court, con_court, guilty, N_G, guilty_2};
private States myState;
// Use this for initialization
void Start () {
myState = States.courtroom_1;
}
// Update is called once per frame
void Update () {
print (myState);
if (myState == States.courtroom_1) {state_courtroom_1();}
else if (myState == States.objection) {state_objection();}
else if (myState == States.courtroom_2) {state_courtroom_2();}
else if (myState == States.g_court) {state_g_court();}
else if (myState == States.N_G) {state_N_G();}
else if (myState == States.con_court) {state_con_court();}
else if (myState == States.b_court) {state_b_court();}
else if (myState == States.guilty) {state_guilty();}
else if (myState == States.guilty_2) {state_guilty_2();}
}
void courtroom_1 () {
text.text = "You have died. Instead of going to heaven or hell (right away) you appear " +
"in a courtroom. An angel and demon are here to judge your actions throughtout " +
"your life. Unfortunately, the demon judge is corrupt (and gets away with it a lot) " +
"and immediately tries to declare you guilty. Do you object? \n\n" +
" Press O to object or S to stay silent." ;
if (Input.GetKeyDown(KeyCode.O)) {myState = States.objection;}
else if (Input.GetKeyDown(KeyCode.S)) {myState = States.guilty;}
}
void state_objection() {
text.text = "You make an objection! You try to argue for a fair trial. But the demon judge " +
"insists on convicting you. Both judges ask if you have something that'll make " +
"reconsider their verdict. You have a piece of evidence that could be really good " +
"but it could be bad depending on their reaction. Do you present it?. \n\n" +
"Press E to mention evidence or C to conceal it." ;
if (Input.GetKeyDown(KeyCode.E)) {myState = States.courtroom_2;}
else if (Input.GetKeyDown(KeyCode.C)) {myState = States.con_court;}
}
void state_courtroom_2() {
text.text = "You mention the charity work you've done throughout the years. The angel judge " +
"nods his head while the demon one shakes his. It looks like it worked. " +
"The judges say that they'll spin a wheel consisted of names of close friends " +
"and family and whatever name the arrow lands on, you can call the person as a " +
"witness. This will help their decision, they claim. They spin the wheel, and it " +
"unluckily lands on your aunt. She hates your guts and will no doubt mention your " +
"bad pass life, which may be bad for you. Then again...you haven't seen her in years. Maybe she " +
"had a change of heart? \n\n" +
"W to call her or N to not call a witness.";
if (Input.GetKeyDown(KeyCode.W)) {myState = States.b_court;}
else if (Input.GetKeyDown(KeyCode.N)) {myState = States.g_court;}
}
void state_g_court() {
text.text = "Both judges simply nod. The demon pulls out a file and mentions something damning. " +
"In your past life, you were a drunk and drug addict. You even murderered a man " +
"and suffered serious jailtime. While you did clean yourself up after release " +
"the demon asks that if your recent good actions should erase your bad actions " +
"and earn you a spot in Heaven. A verdict will be delivered depending on your answer. \n\n" +
"S to give a sappy speach or A to agree and accept your fate."
if (Input.GetKeyDown(KeyCode.S)) {myState = States.N_G;}
else if (Input.GetKeyDown(KeyCode.A)) {myState = States_guilty;}
}
void state_N_G() {
text.text = "The speech was sappy. I mean REALLY sappy...but the angel seemed pleased by it " +
"and deemed you worthy for heaven Congrats!\n\n" +
"Press P to play again." ;
if (Input.GetKeyDown(KeyCode.P)) {myState = States.courtroom_1;}
}
void state_con_court() {
text.text = "You decide not to mention all the charity work you've done. " +
"The angel disappointingly shakes his head while the devil flashes a grin. \n\n " +
"The judges say that they'll spin a wheel consisted of names of close friends " +
"and family and whatever name the arrow lands on, you can call the person as a " +
"witness. This will help their decision, they claim. They spin the wheel, and it " +
"unluckily lands on your aunt. She hates your guts and will no doubt mention your " +
"bad pass life, which may be bad for you. Then again...you haven't seen her in years. Maybe she " +
"had a change of heart? \n\n" +
"W to call her or N to not call a witness."
if (Input.GetKeyDown(KeyCode.W)) {myState = States.b_court;}
else if (Input.GetKeyDown(KeyCode.N)) {myState = States.g_court;}
}
void state_b_court() {
text.text = "It goes just as bad as you expected...maybe even worse. The angel is certainly displeased " +
"and the demon is certainly pleased.The demon then pulls out a file and mentions something damning. " +
"In your past life, you were a drunk and drug addict. You even murderered a man " +
"and suffered serious jailtime. While you did clean yourself up after realease " +
"the demon asks that if your recent good actions should erase your bad actions " +
"and earn you a spot in Heaven. A verdict will be delivered depending on your answer. \n\n" +
"S to give a sappy speach or A to agree and accept your fate."
if (Input.GetKeyDown(KeyCode.S)) {myState = States.guilty;}
else if (Input.GetKeyDown(KeyCode.A)) {myState = States.guilty;}
}
void state_guilty() {
text.text = "Sadly, both judges deemed you worthy for Hell. Oh well. We can't win them all. \n\n" +
"Press P to Play again";
if (Input.GetKeyDown(KeyCode.P)) {myState = States.courtroom_1;}
}
void state_guilty_2() {
text.text = "Sadly, even with your sappy speach, both judges deemed you worthy for Hell. Oh well. We can't win them all. \n\n" +
"Press P to Play again";
if (Input.GetKeyDown(KeyCode.P)) {myState = States.courtroom_1;}
}
}
(Hope I did that right.)