Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class TextController : MonoBehaviour {
- public Text text;
- private enum States {cell, sheets_0, mirror, lock_0, sheets_1, cell_mirror, lock_1, freedom};
- private States myState;
- // Use this for initialization
- void Start () {
- myState = States.cell;
- }
- // Update is called once per frame
- // if so that it starts by saying hello world, but when space is hit, it changes to space key pressed.
- void Update ()
- {
- print (myState);
- if (myState == States.cell) {
- state_cell ();
- } else if (myState == States.sheets_0) {
- state_sheets_0 ();
- } else if (myState == States.mirror) {
- state_mirror ();
- } else if (myState == States.lock_0) {
- state_lock_0 ();
- } else if (myState == States.sheets_1) {
- state_sheets_1 ();
- } else if (myState == States.cell_mirror) {
- state_cell_mirror ();
- } else if (myState == States.lock_1) {
- state_lock_1 ();
- } else if (myState == States.freedom) {
- state_freedom ();
- }
- }
- void state_cell ()
- {
- text.text = "Jared Watson, the most dangerious criminal ever to walk the 7,546,425 realms " +
- "sits in a prison cell after being captured by commander Daniel Medley, leader of the " +
- "order of paper clips. Jared, has been sitting in this prison cell for 7 minutes " +
- " An atternity. He is getting bored and wants to escape. But how? There are some " +
- " dirty sheets on the bed, a mirror on the wall, and the door is locked from the " +
- " ouside.\n\n" +
- "\tPress 'S' to pick up crusty sheets. \n" +
- "\tPress 'M' to look at yourself in the mirror and poke around. \n" +
- "\tPress 'L' to look at the lock. \n";
- if (Input.GetKeyDown (KeyCode.S)) {
- myState = States.sheets_0;
- }
- if (Input.GetKeyDown (KeyCode.M)) {
- myState = States.mirror;
- }
- if (Input.GetKeyDown (KeyCode.L)) {
- myState = States.lock_0;
- }
- }
- void state_sheets_0 ()
- {
- text.text = "You pick up the very crusty, salty smelling sheets, and roll them around " +
- "your hands. 'Gross' you think, as you realise why they \n" +
- "are so crusty.\n\n" +
- "You need to get out of here, away from these very crispy sheets!!! \n\n" +
- "\tPress 'R' to go back to roaming your cell. \n";
- if (Input.GetKeyDown (KeyCode.R)) {
- myState = States.cell;}
- }
- void state_mirror ()
- {
- text.text = " You walk over to the mirror and take a look at yourself. " +
- "'Wow, I look rough', you think to yourself. 'I need to get " +
- "out of here'. You see that the mirror is cracked a bit on the " +
- "edge exposing a screw that is keeping it on the wall. \n\n" +
- "\tPress 'R' to go back to roaming your cell. \n" +
- "\tPress 'M' to lossen the screw and rip the mirror off the wall. \n";
- if (Input.GetKeyDown (KeyCode.R)) {
- myState = States.cell;}
- if (Input.GetKeyDown (KeyCode.M)) {
- myState = States.cell_mirror;}
- }
- void state_lock_0 ()
- {
- text.text = " You stroll over to the lock, and giggle it "+
- "'Locked'. You yank on it; and lean against the door; which "+
- "doesnt bundge an inch. '**SIGH**'. Trapped.\n" +
- "\tPress 'R' to go back to roaming your cell. \n";
- if (Input.GetKeyDown (KeyCode.R)) {
- myState = States.cell;}
- }
- void state_sheets_1 ()
- {
- text.text = " You walk over to your bed with the very crispy sheets; mirror " +
- "in your hands. 'What should I do with this?' 'I dont think I can use this here'" +
- " Maybe I can use this somewhere else. \n\n " +
- "\tPress 'M' to go back to thinking about how to use the mirror. \n";
- if (Input.GetKeyDown (KeyCode.M)) {
- myState = States.cell_mirror;}
- }
- void state_cell_mirror ()
- {
- text.text = " You have this mirror in your hands that you just ripped off the wall" +
- "You have a feeling this can be used to get you out of your cell. But how \n\n" +
- "\tPress 'S' to go investigate the cripsy sheets on your bed to find a clue.\n " +
- "\tPress 'L' to go investigate the lock with the mirror.\n ";
- if (Input.GetKeyDown (KeyCode.S)) {
- myState = States.sheets_1;}
- if (Input.GetKeyDown (KeyCode.L)) {
- myState = States.lock_1;}
- }
- void state_lock_1 ()
- {
- text.text = " You bring the mirror over to the lock. You realize that the mirror has a broken edge that was " +
- "noticed earlier. This would fit right into the keyhole, perfectly! \n\n +" +
- "\tPress 'F' to go try to use the broken edge to unlock the door. \n" +
- "\tPress 'C' to go back to thinking about how to use the mirror, maybe forming another idea";
- if (Input.GetKeyDown (KeyCode.F)) {
- myState = States.freedom;}
- if (Input.GetKeyDown (KeyCode.C)) {
- myState = States.cell_mirror;}
- }
- void state_freedom ()
- {
- text.text = " You here the door lock click as you use the mirror to unlock it!!\n" +
- "\tPress 'R' to go back to run out of the cell. \n";
- if (Input.GetKeyDown (KeyCode.R)) {
- myState = States.freedom;
- print("You won the game!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement