Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.79 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class TextController : MonoBehaviour {
  6.     public bool dogFood;
  7.     public int dogFood_Counter = 100;
  8.     public int dogFood_Max = 100;
  9.     public int dogFood_Min = 0;
  10.     public bool clothes;
  11.     public Text text;
  12.     private enum States {
  13.     cell, bed, bed_1, bed_2, bed_3, bed_4, food, food_1, food_finished, clothes, clothes_1, door, unlocked_door,
  14.     day_2, dogAngry, getShiv, searchGuard, day2, hutInspect, hutShelf, escapeHut
  15.     };
  16.     private States myState;
  17.  
  18.     private enum gear {};  
  19.    
  20.    
  21.     // Use this for initialization
  22.     void Start () {
  23.         myState = States.cell;
  24.         text.text ="Welcome to Tribal Arrest. " + "\n\n\n\nPress Space to continue";
  25.         if (Input.GetKeyDown (KeyCode.Space))                       cell();
  26.     }
  27.    
  28.     // Update is called once per frame
  29.    
  30.     void Update () {
  31.              if (myState ==States.cell)                             {cell();}
  32.         else if (myState ==States.bed)                              {bed();}
  33.         else if (myState ==States.bed_1)                            {bed_1();}
  34.         else if (myState ==States.bed_2)                            {bed_2();}
  35.         else if (myState ==States.bed_3)                            {bed_3();}
  36.         else if (myState ==States.day2)                             {day2();}
  37.         else if (myState ==States.food)                             {food();}
  38.         else if (myState ==States.food_1)                           {food_1();}
  39.         else if (myState ==States.food_finished)                    {foodFinished();}
  40.         else if (myState ==States.clothes)                          {clothes_0();}
  41.         else if (myState ==States.door)                             {door();}
  42.         else if (myState ==States.unlocked_door)                    {doorUnlocked();}
  43.         else if (myState ==States.dogAngry)                         {dogAngry();}
  44.         else if (myState ==States.getShiv)                          {getShiv();}
  45.         else if (myState ==States.searchGuard)                      {searchGuard();}
  46.         else if (myState ==States.hutInspect)                       {hutInspect();}
  47.         else if (myState ==States.escapeHut)                        {escapeHut();} 
  48.        
  49.         if (dogFood_Counter < 25) dogFood = false;
  50.         else if (dogFood_Counter <= 25) dogFood = true;
  51.                    
  52.     }          
  53.         //explain what options are available to the players character, feed new information to grow the storyline (ie. a man walks past with a dog, the dog has keys around his neck, you have dog food, you could get caught and lose the game.)
  54.    
  55.    
  56.     void cell () {
  57.         text.text = "You awake hurt, naked and confused, you're in a cage inside a small wooden hut that is dimly lit. You want to escape. "
  58.                 +"\nThere is a make shift bed, a dog bowl of food, and a small pile of clothes. The cage door is locked from the outside."
  59.                 +"\n\nPress B to get in bed, F to inspect food, C to inspect Clothes";
  60.         if (Input.GetKeyDown (KeyCode.B))           bed();
  61.         if (Input.GetKeyDown (KeyCode.F))           food();
  62.         if (Input.GetKeyDown (KeyCode.C))           clothes_0();
  63.     }  
  64.    
  65.    
  66.     void bed () {
  67.         text.text = "You are in a dirty smelly bed, still confused from your surroundings you comtemplate your next action."
  68.                 + "\nYou could go to sleep and hope things change, or try to find a way out."
  69.                 + "\n\nPress S to try to Sleep, F to inspect the bowl of Food, or C to inspect the Clothes";
  70.         if (Input.GetKeyDown (KeyCode.S))           bed_1();
  71.         if (Input.GetKeyDown (KeyCode.F))           food();
  72.         if (Input.GetKeyDown (KeyCode.C))           clothes_0();
  73.     }
  74.  
  75.     void bed_1 () {
  76.         if (clothes = false) & (dogFood = true);
  77.        
  78.         text.text = "You close your eyes turn over onto your side and try to remember what happened to you."
  79.                 + "\nYou fall asleep, and some time after wake up. You're now hungry and it is turning night."
  80.                 + "\n\nPress F to inspect food, C to inspect the clothes or S to Sleep some more";
  81.                
  82.         if (clothes = false) & (dogFood = true);
  83.         text.text = "You close your eyes turn over onto your side and try to remember what happened to you."
  84.                 + "\nYou fall asleep, and some time after wake up. You're now hungry and it is turning night."
  85.                 + "\n\nPress S to Sleep some more";
  86.         if (clothes = true);
  87.         text.text = "You close your eyes turn over onto your side and try to remember what happened to you."
  88.                 + "\nYou fall asleep, and some time after wake up. You're now hungry and it is turning night."
  89.                 + "\n\nPress Press F to inspect food, or S to sleep some more";
  90.         if (clothes = true);
  91.         text.text = "You close your eyes turn over onto your side and try to remember what happened to you."
  92.                 + "\nYou fall asleep, and some time after wake up. You're now hungry and it is turning night."
  93.                 + "\n\nPress Press F to inspect food, or S to sleep some more";    
  94.                
  95.                
  96.             if  (Input.GetKeyDown (KeyCode.S))
  97.                 text.text = "You cannot sleep anymore..."
  98.                 +"\n\n\nPress F to inspect food, or C to inspect the clothes";
  99.         else if (Input.GetKeyDown (KeyCode.F))              food();
  100.         else if (Input.GetKeyDown (KeyCode.C))
  101.             if  (clothes = false)                               clothes_0();
  102.             if  (clothes = 1);
  103.                 text.text = "You already put the clothes on, they aren't the best but they are warm.\n"
  104.                         +"\nYou should probably get in bed. The guard is starting to look tired!"
  105.                         +"\n\nPress S to Sleep"; ;
  106.     }
  107.     void bed_2 () {
  108.         text.text = "You sit up on the bed. What do you want to do now?"
  109.                 + "\n\n\n Press F to inspect food, D to go to the door";
  110.             if (dogFood > 26)
  111.             if (Input.GetKeyDown (KeyCode.F))           food();
  112.         else if (Input.GetKeyDown (KeyCode.D))          door();
  113.     }
  114.     void bed_3 () {
  115.         text.text = "You sit on the bed. Theres nothing to do but sleep."
  116.                 + "\n\n\n Press S to Sleep, D to go to the door";
  117.                 if (Input.GetKeyDown (KeyCode.S))       bed_4();
  118.         else if (Input.GetKeyDown (KeyCode.D))          door();
  119.     }
  120.     void bed_4 () {
  121.         text.text = "You fall asleep. Wake up, and have a look around. You're still here..."
  122.             + "\nThere is more food in the bowl and the man and dog are sleeping in the corner. What to do...?"
  123.             + "\n\n Press F to inspect food, D to go to the door";
  124.         if (dogFood > 24)
  125.             if (Input.GetKeyDown (KeyCode.S))           day2();
  126.         else if (Input.GetKeyDown (KeyCode.D))          door();
  127.     }
  128.    
  129.     void bed_1_b () {
  130.         text.text = "You get back into bed, turn over onto your side and try to remember what happened to you."
  131.                 + "\nYou fall asleep, and some time after wake up. ."
  132.                 + "\n\nPress F to inspect food, C to inspect the clothes or S to sleep some more";
  133.         if (Input.GetKeyDown (KeyCode.S))
  134.         text.text = "You cannot sleep anymore..."
  135.                 +"\n\n\nPress F to inspect food, or C to inspect the clothes, I to inspect surroundings";
  136.         else if (Input.GetKeyDown (KeyCode.F))          food();
  137.         else if (Input.GetKeyDown (KeyCode.C))          clothes_0();
  138.         else if (Input.GetKeyDown (KeyCode.I))          bedB_inspect();
  139.     }
  140.    
  141.     void bedB_inspect(){
  142.         text.text = "Theres some clothes that should make me feel more comfortable .";
  143.    
  144.     }
  145.    
  146.     void clothes_0 () {
  147.         text.text = "You go over to the clothes. They look like they will fit. They might even be yours. You cannot remember"
  148.                 + "\nYou can try to put them on or return"
  149.                 + "\n\nPress F to inspect Food bowl, W to Wear the clothes";
  150.         if (Input.GetKeyDown (KeyCode.F))               food();
  151.         else if (Input.GetKeyDown (KeyCode.W))          clothes_1();
  152.     }
  153.    
  154.     void clothes_1 () {
  155.         text.text = "As you put on the trousers some coins fall out onto the floor. The coins collide against the cage. A man enters the hut with an old dog."
  156.             + "\nHe looks over to you, gestures for you to be quiet and sits down in a chair across from the cafe. You put the top on quickly."
  157.                 + "\n\nPress D to go to the Door, F to inspect Food bowl, B to sit on the Bed";
  158.         clothes = true;
  159.         if (Input.GetKeyDown (KeyCode.F))               food();
  160.         else if (Input.GetKeyDown (KeyCode.D))          door();
  161.     }
  162.    
  163.  
  164.     void door () {
  165.         if(dogFood => 25)
  166.         text.text = "You slowly approach the door to the cage. The man and his dog are both resting, and might be asleep, it's hard to tell."
  167.                 + "\nGood thing you didn't eat all of the dog food."
  168.                 + "\n\nPress D to go to the Door, F to give the dog the Food, B to sit on the Bed";
  169.         else
  170.         text.text = "You slowly approach the door of the cage. The man and his dog are both resting and might be asleep, it's hard to tell."
  171.                 + "\n You already ate all of the food... You could still try to get the dogs attention."
  172.                 + "\n\nPress D to go to the Door, F to show the dog the Food Bowl, B to sit on the Bed";       
  173.        
  174.         if  (Input.GetKeyDown (KeyCode.F) && dogFood < 24)                              dogAngry();
  175.         else if (Input.GetKeyDown (KeyCode.F) && dogFood > 24)                          doorUnlocked();
  176.         else if (Input.GetKeyDown (KeyCode.B))                                          bed_3();
  177.        
  178.            
  179.     }
  180.     void dogAngry () {
  181.         if(dogFood => 25)
  182.         text.text = "You anger the dog. He doesn't like empty bowls. It growls at you."
  183.                 + "\nThe guard wakes up and point towards your bed."
  184.                 + "\n\nPress B to sit on the Bed";
  185.         if  (Input.GetKeyDown (KeyCode.B))                                              bed_3();
  186.     }
  187.  
  188.     void food () {
  189.         if (clothes = 0)   
  190.         text.text = "You get on your knees and grab the bowl of brown food. It's texture is gooey and it smells rotten." +
  191.                 + "\nYou are hungry but eating this food isn't ideal. You notice you feel cold from the being on the floor."
  192.                 + "\n\nPress T to Taste some of the food, E to Eat the whole bowl, C to go to the Clothes, or L to Leave the food";
  193.                
  194.         else if (clothes = 1)
  195.         text.text = "You get on your knees and grab the bowl of brown food. It's texture is gooey and it smells rotten." +
  196.                 + "\nYou are hungry but eating this food isn't ideal. You notice you feel cold from the being on the floor."
  197.                 + "\n\nPress T to Taste some of the food, E to Eat the whole bowl, C to go to the Clothes, or L to Leave the food";
  198.         if (Input.GetKeyDown (KeyCode.T))               food_1();
  199.         else if (Input.GetKeyDown (KeyCode.L))          bed_2();       
  200.         else if (Input.GetKeyDown (KeyCode.C))          clothes_0();
  201.         else if (Input.GetKeyDown (KeyCode.E))          foodFinished();
  202.     }
  203.    
  204.     void food_1 () {
  205.         dogFood_Counter - 25;
  206.         text.text = "You taste the food, you haven't tasted dog food before, but this could be it."
  207.                 + "\nThe weird taste in your mouth fills you with disgust. You could eat more. It's up to you."
  208.                 + "\n\nPress T to try more, F to finish the dog food, C to inspect the clothes, L to leave the food";
  209.        
  210.         if (Input.GetKeyDown (KeyCode.F))               foodFinished();
  211.         else if (Input.GetKeyDown (KeyCode.T))          food_2();
  212.         else if (Input.GetKeyDown (KeyCode.D))          door();
  213.     }
  214.    
  215.    
  216.     void food_2 () {
  217.         text.text = "You put you hand into the bowl and take some more. You put it in your mouth and chew."
  218.                 + "\nYour face shrivels up as you feel it going down your neck. You could eat more. It's up to you."
  219.                 + "\n\nPress T to Try more, F to finish the dog food, C to inspect the clothes, L to leave the food";
  220.         if (Input.GetKeyDown (KeyCode.F))               foodFinished();
  221.         else if (Input.GetKeyDown (KeyCode.T))          food_3();
  222.         else if (Input.GetKeyDown (KeyCode.C))          foodFinished();
  223.         else if (Input.GetKeyDown (KeyCode.D))          door();
  224.     }
  225.    
  226.    
  227.     void food_3 () {
  228.         text.text = "You put you hand into the bowl once more. As your teeth pierce and burst fluid down your throat..."
  229.                 + "\nyour face shrivels up as you feel it going down your neck. You could eat more though. It's up to you."
  230.                 + "\n\nPress F to finish the dog food, C to inspect the clothes, L to leave the food";
  231.         if (Input.GetKeyDown (KeyCode.F))               foodFinished();
  232.         else if (Input.GetKeyDown (KeyCode.C))          clothes_0();
  233.         else if (Input.GetKeyDown (KeyCode.D))          door();
  234.     }
  235.    
  236.     void foodFinished () {
  237.         text.text = "You lick the bowl clean after finishing the dog food, you animal. You burp and move away from the bowl."
  238.                 + "\nYou're sitting against the cage, and looking around there isn't much inside the cage, you need to find a way out."
  239.                 + "\n\nPress C to inspect the Clothes";
  240.         if (Input.GetKeyDown (KeyCode.C))               clothes_0();
  241.        
  242.     }
  243.     void day2 () {
  244.         text.text = "You wake up again and not much has changed. There is more food and the dog is still here."
  245.                 + "\n"
  246.                 + "\n\nPress B to interact";
  247.         if (Input.GetKeyDown (KeyCode.E))               exitCage();
  248.        
  249.     }
  250.     void doorUnlocked () {
  251.         text.text = "You give the dog  some food, you take the key chain from around its neck. You attempt to open the lock from the inside."
  252.                 + "\nIt's awkward and dificult but you do manage to open the door."
  253.                 + "\n\nPress E to Exit the cage";
  254.         if (Input.GetKeyDown (KeyCode.E))               exitCage();
  255.        
  256.     }
  257.    
  258.     void exitCage () {
  259.         text.text = "You are now standing in the room outside of the cage. The man is there, still sleeping."
  260.                 + "\n You should probably be as quiet as possible. Only knows what he'll to do you if he see's you out of the cage."
  261.                 + "\n\nPress S to Search the man, D to exit though the Door, or I to Inspect the room";
  262.              if (Input.GetKeyDown (KeyCode.S))              searchGuard();
  263.         else if (Input.GetKeyDown (KeyCode.D))              escapeHut();
  264.         else if (Input.GetKeyDown (KeyCode.I))              hutInspect();
  265.        
  266.     }
  267.     void searchGuard () {
  268.         text.text = "You approach the sleeping man, he is wearing a cloth top with a little pocket. You see a small shiv inside."
  269.                 + "\n You should probably be as quiet as possible. Only knows what he'll to do you if he see's you out of the cage."
  270.                 + "\n\nPress S to Search the man";
  271.             if (Input.GetKeyDown (KeyCode.S))               getShiv();
  272.        
  273.     }
  274.     void getShiv () {
  275.         text.text = "You take the shiv from the mans pocket. He wakes up and grabs your arm. You push the shiv directly into his neck."
  276.                 + "\nYou killed a man. Way to go... The dog cowards in the corner as his owner falls off the chair into a pile."
  277.                 + "\n\nPress D to exit through the Door, or I to inspect the room ";
  278.              if (Input.GetKeyDown (KeyCode.D))              escapeHut();
  279.         else if (Input.GetKeyDown (KeyCode.I))              hutInspect();
  280.        
  281.     }
  282.     void escapeHut () {
  283.         text.text = "Still in shock from killing another human you take a moment to look around. It appears you are at an encampment."
  284.                 + "\nThere are two other huts across from you, a path that leads out of the encampment, and another path leading to a large tree."
  285.                 + "\n\nPress H to go to the Huts, L to Leave the encampment, T to go to the Tree or R to return to the hut ";
  286.              if (Input.GetKeyDown (KeyCode.R))              hutInspect();
  287.         else if (Input.GetKeyDown (KeyCode.H))              camp_huts();
  288.         else if (Input.GetKeyDown (KeyCode.L))              exitCamp();
  289.         else if (Input.GetKeyDown (KeyCode.T))              camp_tree();
  290.     }
  291.     void hutInspect () {
  292.         text.text = "You quickly look around the hut. The man is still laying there. There is a shelf with some things on it."
  293.                 + "\nThe dog is still here, but there is nothing more to do here."
  294.                 + "\n\nPress S to Search the shelf, or L to leave the hut ";
  295.              if (Input.GetKeyDown (KeyCode.S))              hutShelf();
  296.         else if (Input.GetKeyDown (KeyCode.L))              escapeHut();
  297.     }
  298.    
  299.     void hutShelf () {
  300.         text.text = "There is an old photo of the man with another two men holding rifles in the air. Next to it is a small satchel and some shells for a .408 rifle"
  301.                 + "\nYou take the shells. There is also a metal flask. You put the empty flask in the small satchel. You put it over your head, pull the strap tight."
  302.                 + "\n\nPress L to leave the hut.";
  303.                 gear.backpack = "Satchel";
  304.              if (Input.GetKeyDown (KeyCode.S))              hutShelf();
  305.         else if (Input.GetKeyDown (KeyCode.L))              escapeHut();
  306.     }
  307. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement