Advertisement
alopgamers

Tomas and the Little Girl

Aug 8th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.55 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class TomasText : MonoBehaviour {
  6.  
  7. public Text text;
  8.  
  9. private enum States {park, park_0, investigate, girl_0, girl_1, bench_0, bushes_0, bushes_1, bench_1, girl_2, ask_0, suggest_0, walk_0, police_0, end};
  10. private States myStates;
  11. int bear = 0;
  12.  
  13. // Use this for initialization
  14. void Start () {
  15. myStates = States.park;
  16. if (Input.GetKeyDown(KeyCode.Escape)) {Application.Quit();}
  17.  
  18. }
  19.  
  20.  
  21. // Update is called once per frame
  22. void Update () {
  23. print (myStates);
  24. if (myStates == States.park) {state_park();}
  25. else if (myStates == States.girl_0) {state_girl_0();}
  26. else if (myStates == States.girl_1) {state_girl_1();}
  27. else if (myStates == States.girl_2) {state_girl_2();}
  28. else if (myStates == States.bench_0) {state_bench_0();}
  29. else if (myStates == States.bushes_0) {state_bushes_0();}
  30. else if (myStates == States.walk_0) {state_walk_0();}
  31. else if (myStates == States.police_0) {state_police_0();}
  32. else if (myStates == States.end) {state_end();}
  33. else if (myStates == States.investigate) {state_investigate();}
  34. else if (myStates == States.park_0) {state_park_0();}
  35. else if (myStates == States.suggest_0) {state_suggest_0();}
  36. else if (myStates == States.bushes_1) {state_bushes_1();}
  37. else if (Input.GetKeyDown(KeyCode.Escape)) {Application.Quit();}
  38. }
  39.  
  40. void state_park() {
  41. text.text = "Walking home from work you hear a sobbing sound at a nearby park \n" +
  42. "Looking closely you see a young girl crying \n\n" +
  43. "Press L to look at the girl, Press A to approach the girl, Press I to look around" ;
  44.  
  45. if (Input.GetKeyDown(KeyCode.L)) {myStates = States.girl_0;}
  46. else if (Input.GetKeyDown(KeyCode.A)) {myStates = States.girl_1;}
  47. else if (Input.GetKeyDown(KeyCode.I)) {myStates = States.investigate;}
  48.  
  49. }
  50.  
  51. void state_girl_0() {
  52. text.text = "You looked at the crying girl, wondering what is wrong \n\n" +
  53. "Press Enter to return to park view";
  54.  
  55.  
  56. if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}
  57.  
  58. }
  59.  
  60. void state_girl_1() {
  61.  
  62. if (bear == 0)
  63. { text.text = "You approached the girl and tried to talk to her " +
  64. "But she is ignoring you \n\n" +
  65. "Press Enter to return to park view";
  66.  
  67.  
  68. if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}}
  69.  
  70.  
  71. else if (bear == 1) {myStates = States.girl_2;}
  72.  
  73. }
  74.  
  75. void state_girl_2() {
  76. text.text = "You gave the bear to the young girl prompting her to stop crying " +
  77. "Asking what is wrong, she told you she had lost her mother \n\n" +
  78. "Press S to suggest a solution";
  79.  
  80.  
  81. if (Input.GetKeyDown(KeyCode.S)) {myStates = States.suggest_0;}
  82.  
  83. }
  84.  
  85.  
  86. void state_investigate() {
  87. if (bear ==0) {
  88. text.text = "Looking closely around you see a nearby bench and a suspicouse looking bush \n\n" +
  89. "Press B to take look at the Bench, Press U to look closer at the Bush" ;
  90.  
  91. if (Input.GetKeyDown(KeyCode.B)) {myStates = States.bench_0;}
  92. else if (Input.GetKeyDown(KeyCode.U)) {myStates = States.bushes_0;}}
  93.  
  94. else {
  95. text.text = "Looking closely around you see a nearby bench and a suspicouse looking bush \n\n" +
  96. "Press B to take look at the Bench, Press U to look closer at the Bush" ;
  97.  
  98. if (Input.GetKeyDown(KeyCode.B)) {myStates = States.bench_0;}
  99. else if (Input.GetKeyDown(KeyCode.U)) {myStates = States.bushes_1;}}
  100.  
  101. }
  102. void state_bench_0() {
  103. text.text = "The benched look a little bit weathered \n\n" +
  104. "Press return to go back to the park" ;
  105.  
  106. if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}
  107.  
  108.  
  109. }
  110.  
  111. void state_bushes_0() {
  112.  
  113. bear = 1;
  114. text.text = "You found a teddy bear \n\n" +
  115. "Press return to go back to the park" ;
  116.  
  117. if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park_0;}}
  118.  
  119.  
  120.  
  121. void state_bushes_1() {
  122.  
  123.  
  124. text.text = "You found nothing else \n\n" +
  125. "Press return to go back to the park" ;
  126.  
  127. if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park_0;}}
  128.  
  129.  
  130.  
  131. void state_park_0() {
  132.  
  133. text.text = "You still see the little girl crying \n\n" +
  134. "Press L to look at the girl, Press A to approach the girl, Press I to look around" ;
  135.  
  136. if (Input.GetKeyDown(KeyCode.L)) {myStates = States.girl_0;}
  137. else if (Input.GetKeyDown(KeyCode.A)) {myStates = States.girl_1;}
  138. else if (Input.GetKeyDown(KeyCode.I)) {myStates = States.investigate;}
  139.  
  140.  
  141. }
  142.  
  143. void state_suggest_0() {
  144.  
  145. text.text = "You tell the girl that everything is alright \n\n" +
  146. "Press W to walk around the neighborhood, Press P to go the police station" ;
  147.  
  148. if (Input.GetKeyDown(KeyCode.W)) {myStates = States.walk_0;}
  149. else if (Input.GetKeyDown(KeyCode.P)) {myStates = States.police_0;}
  150.  
  151. }
  152.  
  153. void state_walk_0() {
  154.  
  155. text.text = "You walked around the neighborhood but could not find the girl's mother \n\n" +
  156. "Press P to go to the Police" ;
  157.  
  158. if (Input.GetKeyDown(KeyCode.P)) {myStates = States.police_0;}
  159.  
  160.  
  161.  
  162. }
  163.  
  164. void state_police_0() {
  165.  
  166. text.text = "You and the girl went to the police " +
  167. "Her mother is waiting there and thanked you for keeping the girl safe \n\n" +
  168. "Press return to go home" ;
  169.  
  170. if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.end;}
  171.  
  172.  
  173.  
  174. }
  175.  
  176. void state_end() {
  177. bear = 0;
  178. text.text = "You went home and felt good for having made a good deed\n\n " +
  179. "Press return to restart" ;
  180.  
  181. if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}
  182.  
  183.  
  184.  
  185. }
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement