Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class TomasText : MonoBehaviour {
- public Text text;
- 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};
- private States myStates;
- int bear = 0;
- // Use this for initialization
- void Start () {
- myStates = States.park;
- if (Input.GetKeyDown(KeyCode.Escape)) {Application.Quit();}
- }
- // Update is called once per frame
- void Update () {
- print (myStates);
- if (myStates == States.park) {state_park();}
- else if (myStates == States.girl_0) {state_girl_0();}
- else if (myStates == States.girl_1) {state_girl_1();}
- else if (myStates == States.girl_2) {state_girl_2();}
- else if (myStates == States.bench_0) {state_bench_0();}
- else if (myStates == States.bushes_0) {state_bushes_0();}
- else if (myStates == States.walk_0) {state_walk_0();}
- else if (myStates == States.police_0) {state_police_0();}
- else if (myStates == States.end) {state_end();}
- else if (myStates == States.investigate) {state_investigate();}
- else if (myStates == States.park_0) {state_park_0();}
- else if (myStates == States.suggest_0) {state_suggest_0();}
- else if (myStates == States.bushes_1) {state_bushes_1();}
- else if (Input.GetKeyDown(KeyCode.Escape)) {Application.Quit();}
- }
- void state_park() {
- text.text = "Walking home from work you hear a sobbing sound at a nearby park \n" +
- "Looking closely you see a young girl crying \n\n" +
- "Press L to look at the girl, Press A to approach the girl, Press I to look around" ;
- if (Input.GetKeyDown(KeyCode.L)) {myStates = States.girl_0;}
- else if (Input.GetKeyDown(KeyCode.A)) {myStates = States.girl_1;}
- else if (Input.GetKeyDown(KeyCode.I)) {myStates = States.investigate;}
- }
- void state_girl_0() {
- text.text = "You looked at the crying girl, wondering what is wrong \n\n" +
- "Press Enter to return to park view";
- if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}
- }
- void state_girl_1() {
- if (bear == 0)
- { text.text = "You approached the girl and tried to talk to her " +
- "But she is ignoring you \n\n" +
- "Press Enter to return to park view";
- if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}}
- else if (bear == 1) {myStates = States.girl_2;}
- }
- void state_girl_2() {
- text.text = "You gave the bear to the young girl prompting her to stop crying " +
- "Asking what is wrong, she told you she had lost her mother \n\n" +
- "Press S to suggest a solution";
- if (Input.GetKeyDown(KeyCode.S)) {myStates = States.suggest_0;}
- }
- void state_investigate() {
- if (bear ==0) {
- text.text = "Looking closely around you see a nearby bench and a suspicouse looking bush \n\n" +
- "Press B to take look at the Bench, Press U to look closer at the Bush" ;
- if (Input.GetKeyDown(KeyCode.B)) {myStates = States.bench_0;}
- else if (Input.GetKeyDown(KeyCode.U)) {myStates = States.bushes_0;}}
- else {
- text.text = "Looking closely around you see a nearby bench and a suspicouse looking bush \n\n" +
- "Press B to take look at the Bench, Press U to look closer at the Bush" ;
- if (Input.GetKeyDown(KeyCode.B)) {myStates = States.bench_0;}
- else if (Input.GetKeyDown(KeyCode.U)) {myStates = States.bushes_1;}}
- }
- void state_bench_0() {
- text.text = "The benched look a little bit weathered \n\n" +
- "Press return to go back to the park" ;
- if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}
- }
- void state_bushes_0() {
- bear = 1;
- text.text = "You found a teddy bear \n\n" +
- "Press return to go back to the park" ;
- if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park_0;}}
- void state_bushes_1() {
- text.text = "You found nothing else \n\n" +
- "Press return to go back to the park" ;
- if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park_0;}}
- void state_park_0() {
- text.text = "You still see the little girl crying \n\n" +
- "Press L to look at the girl, Press A to approach the girl, Press I to look around" ;
- if (Input.GetKeyDown(KeyCode.L)) {myStates = States.girl_0;}
- else if (Input.GetKeyDown(KeyCode.A)) {myStates = States.girl_1;}
- else if (Input.GetKeyDown(KeyCode.I)) {myStates = States.investigate;}
- }
- void state_suggest_0() {
- text.text = "You tell the girl that everything is alright \n\n" +
- "Press W to walk around the neighborhood, Press P to go the police station" ;
- if (Input.GetKeyDown(KeyCode.W)) {myStates = States.walk_0;}
- else if (Input.GetKeyDown(KeyCode.P)) {myStates = States.police_0;}
- }
- void state_walk_0() {
- text.text = "You walked around the neighborhood but could not find the girl's mother \n\n" +
- "Press P to go to the Police" ;
- if (Input.GetKeyDown(KeyCode.P)) {myStates = States.police_0;}
- }
- void state_police_0() {
- text.text = "You and the girl went to the police " +
- "Her mother is waiting there and thanked you for keeping the girl safe \n\n" +
- "Press return to go home" ;
- if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.end;}
- }
- void state_end() {
- bear = 0;
- text.text = "You went home and felt good for having made a good deed\n\n " +
- "Press return to restart" ;
- if (Input.GetKeyDown(KeyCode.Return)) {myStates = States.park;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement