Hey folks! Here’s my game uploaded to itch.io. Please let me know if you have any thoughts, see any bugs, or have any critiques/comments/concerns etc! I also included the code for my TextController below too. Thanks for playing :3 Feel free to comment over on the itch.io page as well~
Link to the game: https://benschiffler.itch.io/prison-game
/*
* Copyright (c) Ben Schiffler
* www.benschiffler.com
*/
using UnityEngine;
using UnityEngine.UI;
public class TextController : MonoBehaviour
{
#region Variables
public Text text;
private enum States { cell, give_up, jeremy_0, bars_0, cell_give_up, jeremy_1, bars_1, corridor_jeremy,
corridor_0, corridor_1, elephant_0, elevator_0, smith, elephant_1, elevator_1, caught,
corridor_2, corridor_3, elevator_2, corridor_4, escape_parrot, end_dream, end_simul, end_real, wake_up};
private States myState;
//Whether or not you stabbed Jeremy (so that you can escape!
private bool stabbedJeremy;
#endregion
#region Unity Methods
void Start()
{
myState = States.cell;
stabbedJeremy = false;
}
void Update()
{
print(myState);
if (myState == States.cell) { cell(); }
else if (myState == States.jeremy_0) { jeremy_0(); }
else if (myState == States.bars_0) { bars_0(); }
else if (myState == States.jeremy_1) { jeremy_1(); }
else if (myState == States.bars_1) { bars_1(); }
else if (myState == States.give_up) { give_up(); }
else if (myState == States.cell_give_up){ cell_give_up(); }
else if (myState == States.corridor_jeremy) { corridor_jeremy(); }
else if (myState == States.corridor_0) { corridor_0(); }
else if (myState == States.corridor_1) { corridor_1(); }
else if (myState == States.elephant_0) { elephant_0(); }
else if (myState == States.elevator_0) { elevator_0(); }
else if (myState == States.smith) { smith(); }
else if (myState == States.caught) { caught(); }
else if (myState == States.elephant_1) { elephant_1(); }
else if (myState == States.elevator_1) { elevator_1(); }
else if (myState == States.corridor_2) { corridor_2(); }
else if (myState == States.corridor_3) { corridor_3(); }
else if (myState == States.elevator_2) { elevator_2(); }
else if (myState == States.corridor_4) { corridor_4(); }
else if (myState == States.escape_parrot) { escape_parrot(); }
else if (myState == States.end_dream) { end_dream(); }
else if (myState == States.end_simul) { end_simul(); }
else if (myState == States.end_real) { end_real(); }
else if (myState == States.wake_up) { wake_up(); }
}
#region State Methods
void wake_up()
{
text.text = "As you hear those words, you find yourself caught, for a moment, in silence. Thank you for playing. This is the real ending.\n\n" +
"Press P to play again.\n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n" +
"Press W to wake up. \n";
if (Input.GetKeyDown(KeyCode.P))
{
myState = States.cell;
}
else if (Input.GetKeyDown(KeyCode.W))
{
myState = States.wake_up;
}
}
void end_real()
{
text.text = "Just because you said it was a real, doesn't make it so. You blink twice as the SimManager slips the HUD off your skull." +
"What a weird game. You think you should play something else from now on, like... \"This is the real ending.\" \n\n" +
"Press P to play a different game. ";
if (Input.GetKeyDown(KeyCode.P))
{
myState = States.wake_up;
}
}
void end_simul()
{
text.text = "Just because you said it was a simulation, doesn't make it so. You rub your eyes as you wake up back in bed. What a weird dream." +
"You attempt to speak, move, get out of bed, but you cannot. You can only say, \"This is the real ending.\" \n\n" +
"Press G to get up and on with your life. ";
if (Input.GetKeyDown(KeyCode.G))
{
myState = States.wake_up;
}
}
void end_dream()
{
text.text = "Just because you said it was a dream, doesn't make it so. Your elevator reaches the top of the shaft, and you step it out into sunlight." +
"You've escaped the prison. Try not to go back there any time soon. Your parrot squawks out, \"This is the real ending.\" \n\n" +
"Press S to step outside. ";
if (Input.GetKeyDown(KeyCode.S))
{
myState = States.wake_up;
}
}
void escape_parrot()
{
text.text = "The elevator chimes, letting you enter. A rough scratching appears behind you, where you see Jeremy standing there, furious. " +
"He kicks at the teeth on the ground for a minute, then vanishes. In his place is his old casserole, just for you, just outta reach. " +
"As the elevator rises, the parrot on your shoulder squawks in a way that can only mean, well. What does it all mean? \n\n" +
"Press W to wake up, this was all a dream.\n" +
"Press S to step out of the elevator, this was all real. \n" +
"Press T to take off your headset, this was all a simulation.";
if (Input.GetKeyDown(KeyCode.W))
{
myState = States.end_dream;
}
else if (Input.GetKeyDown(KeyCode.T))
{
myState = States.end_simul;
}
else if (Input.GetKeyDown(KeyCode.S))
{
myState = States.end_real;
}
}
void corridor_4()
{
text.text = "The elephant walks over you and stares you down. You hear a soft plink, plink, plink as all of your teeth fall out of your mouth. " +
"All 36.16 grams of teeth, straight outta your mouth. Ouch. The elephant shoves you back to the room, clearly uninterested in your toothlessness.\n\n" +
"Press T to put your teeth back in.\n" +
"Press D to approach the doors of the elevator.\n";
if (Input.GetKeyDown(KeyCode.T))
{
myState = States.corridor_3;
}
else if (Input.GetKeyDown(KeyCode.D))
{
myState = States.escape_parrot;
}
}
void caught()
{
text.text = "You mull about for a time, but are soon interrupted by the sound of the scratchy forebodeance. " +
"The last thing you see is Jeremy, dead as a doornail and grinning like a loon, swingin' his " +
"lock to crack you in the dome. \n\n" +
"Press W to wake up. ";
if (Input.GetKeyDown(KeyCode.W))
{
myState = States.cell;
}
}
void elevator_2()
{
text.text = "The elevator chimes, letting you enter. You punch buttons, but nothing happens. " +
"A brass indicator on the wall shows you that you're roughly 36.16 grams over the weight limit. \n\n" +
"Press R to return to the classroom.\n" +
"Press P to punch random buttons until something happens.";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.corridor_3;
}
else if (Input.GetKeyDown(KeyCode.P))
{
myState = States.caught;
}
}
void corridor_3()
{
text.text = "The classroom is spotless, unlike your record. You hear Jeremy's scratching stride approaching. Best be quick about it.\n\n" +
"Press E to approach to the elephant.\n" +
"Press D to approach the doors of the elevator.\n";
if (Input.GetKeyDown(KeyCode.D))
{
myState = States.elevator_2;
}
else if (Input.GetKeyDown(KeyCode.E))
{
myState = States.elephant_1;
}
}
void elephant_0()
{
text.text = "You begin crying as you approach the elephant. You're not sure why. " +
"It's dressed like a dentist. It looks at you with a look that can only mean: \n" +
"Why aren't you in class, young man? Get back to school.\n\n" +
"Press R to return to the classroom.";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.corridor_1;
}
}
void elephant_1()
{
text.text = "You begin crying as you approach the elephant " +
"It's dressed like a dentist. As you approach it, your teeth begin to hurt. " +
"You hear footsteps approaching. Looks like Jeremy's not far off. " +
"The elephant appears busy. Probably doesn't want to be disturbed. " +
"At your feet, you see the ashes of Ms Smith. She died in a house fire, a the end of second grade.\n\n" +
"Press S to resurrect to Ms Smith.\n" +
"Press W to wait the elephant out.\n" +
"Press Y to yell at the elephant.\n" +
"Press R to return to the classroom.";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.corridor_3;
}
else if (Input.GetKeyDown(KeyCode.S))
{
myState = States.smith;
}
else if (Input.GetKeyDown(KeyCode.W))
{
myState = States.caught;
}
else if (Input.GetKeyDown(KeyCode.Y))
{
myState = States.corridor_4;
}
}
void elevator_0()
{
text.text = "As you approach the elevator, Ms Smith gives an angry cough that says you're not getting out of here that easy. \n\n" +
"Press R to return to the classroom.";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.corridor_1;
}
}
void corridor_2()
{
text.text = "Ms Smith nods a curt nod; that will do. She disolves into black powder and slime. \n\n" +
"Press E to approach the elephant.\n" +
"Press D to approach the elevator door.\n";
if (Input.GetKeyDown(KeyCode.E))
{
myState = States.elephant_1;
}
else if (Input.GetKeyDown(KeyCode.D))
{
myState = States.elevator_1;
}
}
void elevator_1()
{
text.text = "The elevator now chimes, letting you enter. You punch buttons, but nothing happens. " +
"A brass indicator on the wall shows you that you're roughly 36.16 grams over the weight limit. \n\n" +
"Press R to return to the classroom.";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.corridor_2;
}
}
void smith()
{
text.text = "Ms Smith looks down her glasses at you in displeasure. She demands you hand over whatever you used to pick that door." +
"That kind of behaviour isn't acceptable here. She will write to your parents - if you had any. \n\n" +
"Press R to return to the classroom.\n" +
"Press K to hand over your boot knife.\n" +
"Press P to hand over your penknife.\n" +
"Press S to hand over your soul.";
if (Input.GetKeyDown(KeyCode.K) || Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.S))
{
myState = States.corridor_2;
} else if (Input.GetKeyDown(KeyCode.R))
{
myState = States.corridor_1;
}
}
void corridor_1()
{
text.text = "You bust around the corner into a room you could swear you've seen before. " +
"It looks a little life your childhood classroom, a little like the dentist, or an office crossed with the zoo. \n" +
"Inside, you see an elephant dentist, a closed elevator, and your schoolteacher Ms Smith. She's dead, and laughing. \n\n" +
"Press E to approach the elephant.\n" +
"Press S to approach Ms Smith.\n" +
"Press D to approach the elevator door.";
if (Input.GetKeyDown(KeyCode.E))
{
myState = States.elephant_0;
}
else if (Input.GetKeyDown(KeyCode.S))
{
myState = States.smith;
}
else if (Input.GetKeyDown(KeyCode.D))
{
myState = States.elevator_0;
}
}
void cell()
{
text.text = "Your head rings like a dancing bell. You can't recall how you got here, but it wasn't pretty. " +
"Jeremy Ducatt looks at you through the bars. He sits, in the way only a " +
"dead man can. You're all alone here, now. Just you and Jeremy's dead-eyed stare.\n\n" +
"Press J to view Jeremy.\n" +
"Press B to inspect the bars.\n" +
"Press G to give up on it all.";
if (Input.GetKeyDown(KeyCode.J))
{
myState = States.jeremy_0;
}
else if (Input.GetKeyDown(KeyCode.B))
{
myState = States.bars_0;
}
else if (Input.GetKeyDown(KeyCode.G))
{
myState = States.give_up;
}
}
void jeremy_0()
{
text.text = "He's dead, yeah, not much more to say. Eyes white, teeth rotten, " +
"nobody but you to remember him. \n\n" +
"Not that you'd care to. Jeremy was not a good kid. \n\n" +
"Killed his best man over a corn casserole. \n\n" +
"Press R to return to roaming your cell. ";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.cell;
}
}
void jeremy_1()
{
stabbedJeremy = true;
text.text = "Jeremy's deader than dead. His eyes shine white in the blade in your hand.\n\n" +
"You reach through and stab him a few times for good measure. \n\n" +
"Hope it was a good casserole. \n\n" +
"Press R to return to roaming your cell. ";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.cell_give_up;
}
}
void bars_0()
{
text.text = "The bars are thick steel, thicker than the fog back home. " +
"And that's saying something. \n\n" +
"There's a thin lock. It reminds you of the locks to Ms. Smith's " +
"Classroom back in elementary, which you opened with your old penknife. " +
"Shame about what happened to her. \n\n" +
"Press R to return to roaming your cell. ";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.cell;
}
}
void bars_1()
{
text.text = "The bars are thick steel, thicker than the fog back home. " +
"And that's saying something. \n\n" +
"There's a thin lock. Just like back in elementary, you jimmy the lock with " +
"the blade in your hand. It opens with a click. \n\n" +
"Press O to open the bars.\n" +
"Press R to return to roaming your cell. ";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.cell_give_up;
}
else if (Input.GetKeyDown(KeyCode.O))
{
if(stabbedJeremy)
{
myState = States.corridor_0;
} else
{
myState = States.corridor_jeremy;
}
}
}
void give_up()
{
text.text = "You've been in here a long time. Longer than you care to recall." +
"Time's being what they is, you think it's time to end it. \n\n" +
"You fish out your fishin' knife from your boot, weighing it in your hand.\n\n" +
"Press E to end it all. \n" +
"Press R to return to roaming your cell.";
if (Input.GetKeyDown(KeyCode.R))
{
myState = States.cell;
}
else if (Input.GetKeyDown(KeyCode.E))
{
myState = States.cell_give_up;
}
}
void cell_give_up()
{
text.text = "You hold the knife, but it sticks to your hand. " +
"You ain't gonna follow Jeremy's way out. Not yet.\n\n" +
"Press J to view Jeremy.\n" +
"Press B to inspect the bars.\n" +
"Press G to put yourself back together and sheathe your knife.";
if (Input.GetKeyDown(KeyCode.J))
{
myState = States.jeremy_1;
}
else if (Input.GetKeyDown(KeyCode.B))
{
myState = States.bars_1;
}
else if (Input.GetKeyDown(KeyCode.G))
{
myState = States.cell;
}
}
void corridor_jeremy()
{
text.text = "The lock falls off and tumbles to the ground. " +
"Freedom tastes sweet; sweet as an apple in the winter. " +
"As you're about to step outside, you hear a rustle behind you. " +
"The last thing you see is Jeremy, dead as a doornail and grinning like a loon, swingin' his " +
"lock to crack you in the dome. \n\n" +
"Press W to wake up. ";
if (Input.GetKeyDown(KeyCode.W))
{
myState = States.cell;
}
}
void corridor_0()
{
text.text = "The lock falls off and tumbles to the ground. " +
"Freedom tastes sweet; sweet as an apple in the winter. " +
"As you're about to step outside, you hear a rustle behind you. " +
"Jeremy staggers forward, lock in his hand. But a couple of knife wounds keep him from gettin ya, just yet. \n" +
"You dart down the hallway, just out of reach. But he's followin' close behind.\n\n" +
"Press R to run Right.\n" +
"Press L to run Left.";
if (Input.GetKeyDown(KeyCode.R) || Input.GetKeyDown(KeyCode.L))
{
myState = States.corridor_1;
}
}
#endregion
#endregion
}