Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private var isClicked : boolean = false;//This variable will change when an NPC is clicked
  2. public var responseString : String = "NO ENTRY!"; //This is the responseString
  3. //It will be updated by switch statements for each button (or question)
  4.  
  5.  
  6. function OnGUI()
  7. {
  8.    
  9.     if(!isClicked) return;
  10.    
  11.         GUI.Box (Rect (Screen.width / 2 - 360,300,700,400), "Guard");
  12.         responseString = GUI.TextArea (Rect (Screen.width / 2 - 200, Screen.height / 2 -50, 400, 50), responseString, 150);
  13.  
  14.         if (GUI.Button(Rect(Screen.width / 2 - 100, Screen.height / 2 + 50, 180, 40), "Can I go in?")) {
  15.            
  16.             responseString = "I said no!";
  17.             }
  18.            
  19.         if (GUI.Button(Rect(Screen.width / 2 - 100, Screen.height / 2 + 100, 180, 40), "I need that necklace!")) {
  20.            
  21.             responseString = "What necklace?";
  22.             }
  23.                        
  24.         if (GUI.Button(Rect(Screen.width / 2 - 100, Screen.height / 2 + 150, 180, 40), "So, United won the title...")) {   
  25.        
  26.             responseString = "Arsenal are bottlers";
  27.             }
  28.            
  29.         if (GUI.Button(Rect(Screen.width / 2 - 100, Screen.height / 2 + 200, 180, 40), "Seeya")) {
  30.            
  31.             responseString = "NO ENTRY";
  32.             isClicked = false;
  33.            
  34.             }      
  35.        
  36.  
  37. }
  38.  
  39. function OnMouseUp()
  40. {
  41.     isClicked = true;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement