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,
- stairs_0, floor, closet_0, corridor_1, stairs_1, closet_1
- };
- 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.corridor_0) {corridor_0();}
- else if (myState == States.stairs_0) {stairs_0();}
- else if (myState == States.floor) {floor();}
- else if (myState == States.closet_0) {closet_0();}
- else if (myState == States.corridor_1) {corridor_1();}
- else if (myState == States.stairs_1) {stairs_1();}
- else if (myState = States.closet_1) {closet_1();}
- }
- void cell () {
- text.text = "You are in a prison cell, and you want to escape. There are " +
- "some dirty sheets on the bed, a mirror on the wall, and the door " +
- "is locked from the outside.\n\n" +
- "Press S to view Sheets, M to view Mirror and L to view 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 dirty old mirror on the wall seems loose.\n\n " +
- "Press T to Take the mirror, or R to Return to your cell.";
- if (Input.GetKeyDown (KeyCode.T)) {myState = States.cell_mirror;}
- else if (Input.GetKeyDown (KeyCode.R)) {myState = States.cell;}
- }
- void cell_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, " +
- "and that pesky door is still there, and firmly locked!\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 seelp in these things. Surley it's " +
- "time somebody changed them. The pleasures of prison life " +
- "I guess!\n\n" +
- "Press R to Return to roaming your cell";
- if (Input.GetKeyDown (KeyCode.R)) {myState = States.cell;}
- }
- void sheets_1 () {
- 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.cell_mirror;}
- }
- void lock_0 () {
- text.text = "This is one of those button locks. Youhave 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.cell;}
- }
- void lock_1 () {
- 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 the 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_0;}
- else if (Input.GetKeyDown (KeyCode.R)) {myState = States.cell_mirror;}
- }
- void corridor_0() {
- text.text = "You have escaped your cell! Now there's still the problem of leaving " +
- "the prison. There are a set of stairs that lead up, the floor below you " +
- "has a set of footprints leading somewhere and there is also a utility closet.\n\n" +
- "Press S to go up the Stairs, F to inspect the floor, or C to open the closet.";
- if (Input.GetKeyDown (KeyCode.S)) {myState = States.stairs_0;}
- else if (Input.GetKeyDown (KeyCode.F)) {myState = States.floor;}
- else if (Input.GetKeyDown (KeyCode.C)) {myState = States.closet_0;}
- }
- void stairs_0 () {
- text.text = "You seem to be on an old staircase. " +
- "there doesn't seem to be anything in here. " +
- "The stairs are a dead end.\n\n" +
- "Press R to Return to your cell.";
- if (Input.GetKeyDown (KeyCode.R)) {myState = States.corridor_0;}
- }
- void floor () {
- text.text = "You inspect the floor. " +
- "there doesn't seem to be anything in here except an old hairclip.\n\n" +
- "Press H to pick up the Hairclip, or R to Return.";
- if (Input.GetKeyDown (KeyCode.R)) {myState = States.corridor_0;}
- else if (Input.GetKeyDown (KeyCode.H)) {myState = States.corridor_1;}
- }
- void closet_0() {
- text.text = "The closet is locked. Find a way to get in.";
- if(Input.GetKey(KeyCode.R)) {myState = States.closet_0;}
- }
- void corridor_1() {
- text.text = "Now that you've got the Hairclip you can pick locks\n\n" +
- "Press S to go up the staircase, or press P to pick the lock to the closet";
- if(Input.GetKey(KeyCode.S)) {myState = States.stairs_1;}
- else if (Input.GetKey(KeyCode.P)) {myState = States.closet_1;}
- }
- void stairs_1() {
- text.text = "It's the same empty staircase. Nothing to help you here...\n\n" +
- "Press R to Return.";
- if(Input.GetKey(KeyCode.R)) {myState = States.corridor_1;}
- }
- void closet_1() {
- text.text = "You've made it into the closet.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement