Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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, corridor_0, left_corridor, cell_2,
- stairs_2, courtyard, right_corridor, canteen, corridor_2, corridor_3, table, kitchen};
- 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) {cell();}
- else if (myState == States.sheets_0) {sheets_0();}
- else if (myState == States.sheets_1) {sheets_1();}
- else if (myState == States.lock_0) {lock_0();}
- else if (myState == States.lock_1) {lock_1();}
- else if (myState == States.mirror) {mirror();}
- else if (myState == States.cell_mirror) {cell_mirror();}
- else if (myState == States.left_corridor) {left_corridor();}
- else if (myState == States.cell_2) {cell_2();}
- else if (myState == States.stairs_2) {stairs_2();}
- else if (myState == States.kitchen) {kitchen();}
- else if (myState == States.courtyard) {courtyard();}
- else if (myState == States.right_corridor) {right_corridor();}
- else if (myState == States.canteen) {canteen();}
- else if (myState == States.corridor_2) {corridor_2();}
- else if (myState == States.corridor_3) {corridor_3();}
- else if (myState == States.table) {table();}
- }
- void table() {
- text.text = "You walk over to the nearest table to you, it is made from heavy wood boards and appears to have been in the room " +
- "for an extremely long time. You can see small stains that look like they could be bits of food or drink. " +
- "This must be the prison's canteen\n\n" +
- "Press R to return to Roaming the canteen";
- if (Input.GetKeyDown(KeyCode.R)) {myState = States.canteen;}
- }
- void corridor_3() {
- text.text = "You're standing back in the corridor, now convincingly dressed as a cleaner. " +
- "You strongly consider the run for freedom.\n\n" +
- "Press S to take the Stairs, or U to Undress";
- if (Input.GetKeyDown(KeyCode.S)) {myState = States.courtyard;}
- }
- 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.S)) {myState = States.stairs_2;}
- }
- void canteen() {
- text.text = "You turn the key in the lock, noticing it takes less effort this time to open the doors. " +
- "You step into a large room, it must be big enough to hold 300 people. Lamps hang from the ceiling " +
- "and tables line the walls and fill the center of the room. At the far end you can see another door made, " +
- "this time of metal.\n\n" +
- "Press T to look at the Tables or D to look at the metal Door.";
- if (Input.GetKeyDown(KeyCode.T)) {myState = States.table;}
- else if (Input.GetKeyDown(KeyCode.S)) {myState = States.kitchen;}
- }
- void kitchen() {
- text.text = "You turn the key in the lock, noticing it takes less effort this time to open the doors. " +
- "You step into a large room, it must be big enough to hold 300 people. Lamps hang from the ceiling " +
- "and tables line the walls and fill the center of the room. At the far end you can see another door made, " +
- "this time of metal.\n\n" +
- "Press T to look at the Tables or D to look at the metal Door.";
- if (Input.GetKeyDown(KeyCode.T)) {myState = States.table;}
- else if (Input.GetKeyDown(KeyCode.S)) {myState = States.kitchen;}
- }
- void right_corridor () {
- text.text = "To your right there is a pair of wooden doors, this looks like a main entrance to a room. The lock on " +
- "them looks the same as the one in your cell.\n\n" +
- "Press R to Return to the standing, or O to open the double doors." ;
- if (Input.GetKeyDown(KeyCode.R)) {myState = States.corridor_0;}
- else if (Input.GetKeyDown(KeyCode.O)) {myState = States.canteen;}
- }
- void courtyard () {
- text.text = "You walk through the courtyard dressed as a cleaner. " +
- "The guard tips his hat at you as you waltz past, claiming " +
- "your freedom. You heart races as you walk into the sunset.\n\n" +
- "Press P to Play again." ;
- if (Input.GetKeyDown(KeyCode.P)) {myState = States.cell;}
- }
- void left_corridor () {
- text.text = "Being as you cannot see the end of the corridor through the darkness, you take the torch from the wall " +
- "and head left. You soon come to a dead end, in the wall ther is a wooden door similar to the one on " +
- "Yyour cell.\n\n" +
- "Press R to Return to the corridor." ;
- if (Input.GetKeyDown(KeyCode.R)) {myState = States.corridor_0;}
- }
- void cell_2 () {
- text.text = "Unfortunately weilding a puny hairclip hasn't given you the " +
- "confidence to walk out into a courtyard surrounded by armed guards!\n\n" +
- "Press R to Retreat down the stairs" ;
- if (Input.GetKeyDown(KeyCode.R)) {myState = States.canteen;}
- }
- 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 cell () {
- text.text = "You wake up in a prison cell, the walls are made of stone blocks and moss grows in the cracks. " +
- "On the bed you can see a pile of filthy sheets, on the wall hangs a broken mirror and the heavy " +
- "wooden door appears to be locked.\n\n" +
- "Press S to look at the Sheets, M to look at the Mirror or L to look at the Lock" ;
- if (Input.GetKeyDown(KeyCode.S)) {myState = States.sheets_0;}
- else if (Input.GetKeyDown(KeyCode.M)) {myState = States.mirror;}
- else if (Input.GetKeyDown(KeyCode.L)) {myState = States.lock_0;}
- }
- void mirror() {
- text.text = "The mirror is smashed into fragments that are still loosley attatched to the frame. " +
- "One of the fragments seems to stick out more than the others and appears to be very loose.\n\n" +
- "Press T to Take the fragment, or R to continue Roaming cell" ;
- if (Input.GetKeyDown(KeyCode.T)) {myState = States.cell_mirror;}
- else if (Input.GetKeyDown(KeyCode.R)) {myState = States.cell;}
- }
- void cell_mirror() {
- text.text = "After grabbing the mirror fragment, all of the pieces fell from the frame to the ground with a loud crash! " +
- "When you look back at the frame, you notice a small bronze key hanging from a thread, you tie the thread around " +
- "your neck and you stand up to survey your cell once more.\n\n" +
- "Press S to view Sheets, or L to view Lock" ;
- if (Input.GetKeyDown(KeyCode.S)) {myState = States.sheets_1;}
- else if (Input.GetKeyDown(KeyCode.L)) {myState = States.lock_1;}
- }
- void sheets_0 () {
- text.text = "You can't believe you sleep in these things. Surely it's time somebody changed them. They are covered in " +
- "stains and marks of countless colours and you're glad you dont recognise the stain on the floor beneath the matress. " +
- "The sheets offer you no assistance in escaping.\n\n" +
- "Press R to continue Roaming your cell" ;
- if (Input.GetKeyDown(KeyCode.R)) {myState = States.cell;}
- }
- void sheets_1() {
- text.text = "Having a key doesn't seem to make the sheets look any better and they still offer you no help in escaping.\n\n " +
- "Press R to continue Roaming your cell" ;
- if (Input.GetKeyDown(KeyCode.R)) {myState = States.cell_mirror;}
- }
- void lock_0() {
- text.text = "The metal lock on the door is locked. Looking through the small keyhole you can see a dark corridor outside " +
- "with faint light reflecting on the we floor. The walls of the corridor seem to be made from the same stone as " +
- "your cell. Without a way to open the lock, it's useless.\n\n" +
- "Press R to continue Roaming your cell" ;
- if (Input.GetKeyDown(KeyCode.R)) {myState = States.cell;}
- }
- void lock_1() {
- text.text = "Looking closer at the lock, you can see that the thick metal is scratched and dented from years of use, " +
- "the small holes in the door above the lock also appear to show that it has been replaced several times. " +
- "The lock needs a small key to open it, perhapse the one you found will do the trick.\n\n" +
- "Press O to Open, or R to Return to your cell" ;
- if (Input.GetKeyDown (KeyCode.O)) {myState = States.corridor_0;}
- else if (Input.GetKeyDown (KeyCode.R)) {myState = States.cell_mirror;}
- }
- void corridor_0() {
- text.text = "The lock makes a quiet click after you insert the key and twist with some effort, it appears that the lock has not been used recently. " +
- "Stepping out into the corridor you can see no end to the left and a set of wooden doors down the corridor to your right. The walls of " +
- "were indeed made from the same stone, and the light eminates from a torch on the wall opposite your cell.\n\n" +
- "Press L to go Left or R to go Right";
- if (Input.GetKeyDown (KeyCode.L)) {myState = States.left_corridor;}
- else if (Input.GetKeyDown (KeyCode.R)) {myState = States.right_corridor;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement