Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.98 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class TextController : MonoBehaviour {
  7.  
  8.     public Text text;
  9.     private enum States {cell, sheets_0, mirror, lock_0, sheets_1, cell_mirror, lock_1, freedom};
  10.     private States myState;
  11.  
  12.     // Use this for initialization
  13.     void Start () {
  14.         myState = States.cell;
  15.     }
  16.  
  17.     // Update is called once per frame
  18.     // if so that it starts by saying hello world, but when space is hit, it changes to space key pressed.
  19.     void Update ()
  20.     {
  21.         print (myState);
  22.         if (myState == States.cell) {
  23.             state_cell (); 
  24.         } else if (myState == States.sheets_0) {
  25.             state_sheets_0 ();
  26.         } else if (myState == States.mirror) {
  27.             state_mirror ();
  28.         } else if (myState == States.lock_0) {
  29.             state_lock_0 ();
  30.         } else if (myState == States.sheets_1) {
  31.             state_sheets_1 (); 
  32.         } else if (myState == States.cell_mirror) {
  33.             state_cell_mirror ();
  34.         } else if (myState == States.lock_1) {
  35.             state_lock_1 ();
  36.         } else if (myState == States.freedom) {
  37.             state_freedom ();
  38.             }
  39.         }
  40.    
  41.     void state_cell ()
  42.     {
  43.         text.text = "Jared Watson, the most dangerious criminal ever to walk the 7,546,425 realms " +
  44.         "sits in a prison cell after being captured by commander Daniel Medley, leader of the " +
  45.         "order of paper clips. Jared, has been sitting in this prison cell for 7 minutes " +
  46.         " An atternity. He is getting bored and wants to escape. But how? There are some " +
  47.         " dirty sheets on the bed, a mirror on the wall, and the door is locked from the " +
  48.         " ouside.\n\n" +
  49.         "\tPress 'S' to pick up crusty sheets. \n" +
  50.         "\tPress 'M' to look at yourself in the mirror and poke around. \n" +
  51.         "\tPress 'L' to look at the lock. \n";
  52.         if (Input.GetKeyDown (KeyCode.S)) {
  53.             myState = States.sheets_0;
  54.         }
  55.         if (Input.GetKeyDown (KeyCode.M)) {
  56.             myState = States.mirror;
  57.         }
  58.         if (Input.GetKeyDown (KeyCode.L)) {
  59.             myState = States.lock_0;
  60.         }
  61.         }
  62.  
  63.     void state_sheets_0 ()
  64.     {
  65.         text.text = "You pick up the very crusty, salty smelling sheets, and roll them around " +
  66.                     "your hands. 'Gross' you think, as you realise why they \n" +
  67.                     "are so crusty.\n\n" +
  68.                     "You need to get out of here, away from these very crispy sheets!!! \n\n" +
  69.         "\tPress 'R' to go back to roaming your cell. \n";
  70.         if (Input.GetKeyDown (KeyCode.R)) {
  71.             myState = States.cell;}
  72.     }
  73.  
  74.     void state_mirror ()
  75.     {
  76.         text.text = " You walk over to the mirror and take a look at yourself. " +
  77.                     "'Wow, I look rough', you think to yourself. 'I need to get " +
  78.                     "out of here'. You see that the mirror is cracked a bit on the " +
  79.                     "edge exposing a screw that is keeping it on the wall. \n\n" +
  80.         "\tPress 'R' to go back to roaming your cell. \n" +
  81.         "\tPress 'M' to lossen the screw and rip the mirror off the wall. \n";
  82.  
  83.         if (Input.GetKeyDown (KeyCode.R)) {
  84.             myState = States.cell;}
  85.         if (Input.GetKeyDown (KeyCode.M)) {
  86.             myState = States.cell_mirror;}
  87.     }
  88.     void state_lock_0 ()
  89.     {
  90.         text.text = " You stroll over to the lock, and giggle it "+
  91.                     "'Locked'. You yank on it; and lean against the door; which "+
  92.                     "doesnt bundge an inch. '**SIGH**'. Trapped.\n" +
  93.         "\tPress 'R' to go back to roaming your cell. \n";
  94.  
  95.         if (Input.GetKeyDown (KeyCode.R)) {
  96.             myState = States.cell;}
  97.     }
  98.     void state_sheets_1 ()
  99.     {
  100.         text.text = " You walk over to your bed with the very crispy sheets; mirror " +
  101.         "in your hands. 'What should I do with this?' 'I dont think I can use this here'" +
  102.         " Maybe I can use this somewhere else. \n\n " +
  103.         "\tPress 'M' to go back to thinking about how to use the mirror. \n";
  104.  
  105.         if (Input.GetKeyDown (KeyCode.M)) {
  106.             myState = States.cell_mirror;}
  107.     }
  108.     void state_cell_mirror ()
  109.     {
  110.         text.text = " You have this mirror in your hands that you just ripped off the wall" +
  111.         "You have a feeling this can be used to get you out of your cell. But how \n\n" +
  112.         "\tPress 'S' to go investigate the cripsy sheets on your bed to find a clue.\n " +
  113.         "\tPress 'L' to go investigate the lock with the mirror.\n ";
  114.  
  115.         if (Input.GetKeyDown (KeyCode.S)) {
  116.             myState = States.sheets_1;}
  117.         if (Input.GetKeyDown (KeyCode.L)) {
  118.             myState = States.lock_1;}
  119.     }
  120.     void state_lock_1 ()
  121.     {
  122.         text.text = " You bring the mirror over to the lock. You realize that the mirror has a broken edge that was " +
  123.         "noticed earlier. This would fit right into the keyhole, perfectly! \n\n +" +
  124.         "\tPress 'F' to go try to use the broken edge to unlock the door. \n" +
  125.         "\tPress 'C' to go back to thinking about how to use the mirror, maybe forming another idea";
  126.  
  127.         if (Input.GetKeyDown (KeyCode.F)) {
  128.             myState = States.freedom;}
  129.         if (Input.GetKeyDown (KeyCode.C)) {
  130.             myState = States.cell_mirror;}
  131.     }
  132.     void state_freedom ()
  133.     {
  134.         text.text = " You here the door lock click as you use the mirror to unlock it!!\n" +
  135.         "\tPress 'R' to go back to run out of the cell. \n";
  136.  
  137.         if (Input.GetKeyDown (KeyCode.R)) {
  138.             myState = States.freedom;
  139.             print("You won the game!");
  140.             }
  141.     }
  142.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement