Skip to content

Instantly share code, notes, and snippets.

Created September 23, 2016 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f8a694f00371b4589f04383256776d87 to your computer and use it in GitHub Desktop.
Save anonymous/f8a694f00371b4589f04383256776d87 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class TextTransformer : MonoBehaviour {
public Text text;
private enum States{cell,escape,stay,sheets,mirror,door,air_duct,freedom, spoon,
escape_02, mirror_02, sheets_02, door_02, spoon_02, duct_02,
escape_03, mirror_03, sheets_03, door_03, spoon_03, duct_03,
corridor, stairs_0, closet_door, floor, corridor_1, stairs_1,
in_closet, corridor_2, stairs_2, corridor_3, courtyard}
private States MyState;
// Use this for initialization
void Start () {
MyState = States.cell;
}
// Update is called once per frame
void Update () {
// You access each of the functions my conditioning the enum
print(MyState);
if (MyState == States.cell) {state_cell();}
else if (MyState == States.stay) {state_stay();}
else if (MyState == States.escape) {state_escape();}
else if (MyState == States.sheets) {state_sheets_01();}
else if (MyState == States.mirror) {state_mirror_01();}
else if (MyState == States.spoon) {state_spoon_01();}
else if (MyState == States.door) {state_door();}
else if (MyState == States.air_duct) {state_air();}
else if (MyState == States.escape_02) {state_escape_mirror();}
else if (MyState == States.sheets_02) {state_02_sheets();}
else if (MyState == States.door_02) {state_02_door();}
else if (MyState == States.duct_02) {state_02_duct();}
else if (MyState == States.spoon_02) {state_02_spoon();}
else if (MyState == States.escape_03) {state_escape_spoon();}
else if (MyState == States.mirror_03) {state_03_mirror();}
else if (MyState == States.sheets_03) {state_03_sheets();}
else if (MyState == States.door_03) {state_03_door();}
else if (MyState == States.duct_03) {state_03_duct();}
else if (MyState == States.corridor) {state_03_corridor();}
else if (MyState == States.closet_door) {closet_door();}
else if (MyState == States.stairs_0) {stairs_0();}
else if (MyState == States.floor) {floor();}
else if (MyState == States.corridor_1) {corridor();}
else if (MyState == States.in_closet) {inCloset();}
else if (MyState == States.stairs_1) {stairs_1();}
else if (MyState == States.freedom) {freedom();}
else if (MyState == States.corridor_2) {corridor_2();}
else if (MyState == States.stairs_2) {stairs_2();}
else if (MyState == States.corridor_3) {corridor_3();}
}
void state_cell (){
// estado antes de empezar el videojuego ¿Escapar o no escapar?
text.text = "You were sentenced to a life in jail because you murdered a waitress. " +
"You're not pretty sure what happen that night, but you think you are NOT gulty. " +
"There's a problem. How to prove your inocence while in jail? There is just one solution "+
"YOU GOTTA ESCAPE\n\n" +
"Press E if you want to Escape or press S if you want to Stay";
if (Input.GetKeyDown(KeyCode.S)) {MyState = States.stay;}
else if (Input.GetKeyDown(KeyCode.E)) {MyState = States.escape;}
}
// Funcion cuando se decide escapar se pueden tomar 5 decisiones
void state_escape(){
text.text = "GREAT! You just made the best decision in your life. In your cell you just have "+
"some dirty Sheets, a mirror and a stolen spoon from the dinning room. "+
"You could use the front door to scape but you need to find a way to open it or "+
"you could find a way to use the air duct to scape\n\n"+
"Press S to look in the Sheets, press M to look in the Mirror, press D to go to the door "+
"press A to go to the Air Duct or P for Spoon";
if (Input.GetKeyDown(KeyCode.S)) {MyState = States.sheets;}
else if (Input.GetKeyDown(KeyCode.M)) {MyState = States.mirror;}
else if (Input.GetKeyDown(KeyCode.D)) {MyState = States.door;}
else if (Input.GetKeyDown(KeyCode.A)) {MyState = States.air_duct;}
else if (Input.GetKeyDown(KeyCode.P)) {MyState = States.spoon;}
}
// Sabanas numero 1 solo hay regreso
void state_sheets_01(){
text.text = "You can't belive you'd sleep in these things. Surely It's time somebody changed them "+
"The pleasures of prison life\n\n" +
"Press 'R' to return to roaming your cell";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape;}
}
// Puerta Numero uno solo hay regreso
void state_door(){
text.text = "This is one of those button locks. You have no idea what the " +
"combination is. You wish you could somehow see where the dirty " +
"fingerprints were, maybe that would help.\n\n" +
"Press R to Return to roaming your cell" ;
if ( Input.GetKeyDown(KeyCode.R)) {MyState = States.escape;}
}
void state_air(){
text.text = "There's an air duct. It's a little small for you but if you could scrape the wall of the air you might get in it" +
"You might find something in your cell to scrape th walls \n\n"+
"Press R to return to cell ";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape;}
}
// espejo (puedes tomarlo o regresar a tu celda )
void state_mirror_01(){
text.text = "The dirty old mirror on the wall seems loose.\n\n" +
"Press T to Take the mirror, or R to Return to cell" ;
if (Input.GetKeyDown(KeyCode.T)) {MyState = States.escape_02;}
else if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape;}
}
// cuchara numero 1 (la tomas o regresas)
void state_spoon_01(){
text.text = "You just stole this spoon from the dinning hall. Neither the cops or your mates realized you stole it "+
"It might be helpfull. May be to scrape something very thick.\n\n" +
"Press T to Take the spoon, press R to return to roaming your cell";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape;}
else if (Input.GetKeyDown(KeyCode.T)) {MyState = States.escape_03;}
}
void state_escape_mirror(){
text.text = "You are still in your cell, and you STILL want to escape! There are " +
"some dirty sheets on the bed, a mark where the mirror was, " +
"There's the air duct and the spoon you robbed "+
"and that pesky door is still there, and firmly locked!\n\n" +
"Press S to view Sheets, press L to view Lock, press P to look at the spoon or press A to look at te duct";
if (Input.GetKeyDown(KeyCode.S)) {MyState = States.sheets_02;}
else if (Input.GetKeyDown(KeyCode.L)) {MyState = States.door_02;}
else if (Input.GetKeyDown(KeyCode.P)) {MyState = States.spoon_02;}
else if (Input.GetKeyDown(KeyCode.A)) {MyState = States.duct_02;}
}
void state_02_sheets(){
text.text = "Holding a mirror in your hand doesn't make the sheets look " +
"any better.\n\n" +
"Press R to Return to roaming your cell" ;
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_02;}
}
void state_02_door(){
text.text = "You carefully put the mirror through the bars, and turn it round " +
"so you can see the lock. You can just make out fingerprints around " +
"the buttons. You press the dirty buttons, and hear a click.\n\n" +
"Press O to Open, or R to Return to your cell" ;
if (Input.GetKeyDown(KeyCode.O)) {MyState = States.corridor;}
else if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_02;}
}
void state_02_spoon(){
text.text = "You might save this spoon in case you escape as a memory of your time in prision\n\n"+
"Press R to return to your cell";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_02;}
}
void state_02_duct(){
text.text = "Your are so thankfull with the air duct because it brought you fresh air in moments of desperation\n\n"+
"Press R to return to your cell";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_02;}
}
void state_escape_spoon(){
text.text = "You are still in your cell, and you STILL want to escape! There are " +
"some dirty sheets on the bed, but you have now the spoon" +
"There's the door locked and the mirror"+
"and that pesky Air Duct still to small!\n\n" +
"Press S to view Sheets, press L to view Lock, press M to look at the mirror or press A to look at te duct";
if (Input.GetKeyDown(KeyCode.M)) {MyState = States.mirror_03;}
else if (Input.GetKeyDown(KeyCode.L)) {MyState = States.door_03;}
else if (Input.GetKeyDown(KeyCode.S)) {MyState = States.sheets_03;}
else if (Input.GetKeyDown(KeyCode.A)) {MyState = States.duct_03;}
}
void state_03_mirror(){
text.text = "This mirror remembered who you were every time you looked in it \n\n" +
"Press R to return to the cell";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_03;}
}
void state_03_door(){
text.text = "This will be the las time you will be locked by this door\n\n" +
"Press R to return to the cell ";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_03;}
}
void state_03_sheets(){
text.text = "this dirty sheets will never touch you again. But you gotta hurry!\n\n"+
"Press R to return to the cell";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_03;}
}
void state_03_duct(){
text.text = "You carefully start scraping the wall of the air duct making them larger so you can fit the air duct "+
"There's your way out. You need to get in the duct\n\n"+
"Press G to Get in the duct or press R to Return to your cell";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.escape_03;}
else if (Input.GetKeyDown(KeyCode.G)) {MyState = States.corridor; }
}
void state_03_corridor(){
text.text = "You are out of your cell. Now you are in the corridor you need to find a way out! "+
"There's some stairs leading the courtyard a closet to your right. Also the floor "+
"is very dirty there are many things you don't see from the heights\n\n"+
"Press C to open the Closet, press S to go to the Stairs or press or press F to inspect the Floor";
if (Input.GetKeyDown(KeyCode.C)) {MyState = States.closet_door;}
else if (Input.GetKeyDown(KeyCode.F)) {MyState = States.floor;}
else if (Input.GetKeyDown(KeyCode.S)) {MyState = States.stairs_0;}
}
void closet_door(){
text.text = "The door is locked. You need to find a way to open it to see what you can get from there\n\n "+
"press R to return to the corridor";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.corridor;}
}
void stairs_0(){
text.text = "that's your way out! But there's a little problem. A guard and a dog are watching the entrance. "+
"You gotta find a way to pass through that stairs. \n\n" +
"press R to return to the corridor";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.corridor;}
}
void floor(){
text.text = "Rummagaing around on the dirty floor, you find a hairclip.\n\n" +
"Press R to Return to the corridor, or H to take the Hairclip." ;
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.corridor;}
else if (Input.GetKeyDown(KeyCode.H)) {MyState = States.corridor_1;}
}
void corridor(){
text.text = "Still in the corridor. Floor still dirty. Hairclip in hand. " +
"Now what? You wonder if that lock on the closet would succumb to " +
"to some lock-picking?\n\n" +
"P to Pick the lock, and S to climb the stairs";
if (Input.GetKeyDown(KeyCode.P)) {MyState = States.in_closet;}
else if (Input.GetKeyDown(KeyCode.S)) {MyState = States.stairs_1;}
}
void stairs_1(){
text.text = "Unfortunately weilding a puny hairclip hasn't given you the " +
"key to surpass the police guard and the dog!\n\n" +
"Press R to Retreat down the stairs" ;
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.corridor_1;}
}
void inCloset(){
text.text = "Inside the closet you see a cleaner's uniform that looks about your size! " +
"Seems like your day is looking-up.\n\n" +
"Press D to Dress up, or R to Return to the corridor";
if (Input.GetKeyDown(KeyCode.D)) {MyState = States.corridor_3;}
else if (Input.GetKeyDown(KeyCode.R)) {MyState = States.corridor_2;}
}
void corridor_2(){
text.text = "Back in the corridor, having declined to dress-up as a cleaner.\n\n" +
"Press C to revisit the Closet, and S to climb the stairs";
if (Input.GetKeyDown(KeyCode.C)) {MyState = States.in_closet;}
else if (Input.GetKeyDown(KeyCode.S)) {MyState = States.stairs_2;}
}
void stairs_2(){
text.text = "You feel smug for picking the closet door open, and are still armed with " +
"a hairclip (now badly bent). Even these achievements together don't give " +
"you the courage to climb up the staris to your death!\n\n" +
"Press R to Return to the corridor";
if (Input.GetKeyDown(KeyCode.R)) {MyState = States.corridor_2;}
}
void corridor_3(){
text.text = "You are now dressed up as cleaner. Now is your chance tu escape. It's now or never "+
"This is the chance to change your life \n\n "+
"Press S to to take the Stairs, or U to undress";
if (Input.GetKeyDown(KeyCode.S)) {MyState = States.freedom;}
else if (Input.GetKeyDown(KeyCode.U)) {MyState = States.in_closet;}
}
void freedom(){
text.text = "You are FREE!\n\n" +
"Press P to Play again";
if (Input.GetKeyDown(KeyCode.P)) {MyState = States.cell;}
}
void state_stay(){
text.text = "You were considered a threat to all the other prisioners. Because you decided to stay "+
"you just got killed. A bunch of guys approached you and stabed you in the stomach and "+
"You are about to die and all you can think is how you choose to stay \n\n"+
"GAME OVER!\n\n"+
"Press p to play again";
if (Input.GetKeyDown(KeyCode.P)) {MyState = States.cell;}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment