Guest User

Untitled

a guest
Jan 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. function OnTriggerStay (other: Collider) {
  2. if(other.gameObject.tag == "Player" && encumblink.Encumbrance <= 5)
  3. {
  4. npctrigger = true;
  5. }
  6. if(other.gameObject.tag == "Player" && encumblink.Encumbrance > 5)
  7. {
  8. npctrigger = false;
  9. no_coop_button = true;
  10.  
  11. }
  12. }
  13.  
  14. function OnTriggerExit ()
  15. {
  16. npctrigger = false;
  17. }
  18.  
  19. function OnGUI()
  20. {
  21. if (no_coop_button)
  22. {
  23. GUI.BeginGroup (Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100));
  24. GUI.Box (Rect(0, 0, 100, 100), "You are \n a thief");
  25. GUI.EndGroup ();
  26. }
  27.  
  28. if (npctrigger)
  29. {
  30. GUI.BeginGroup (Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100));
  31. }
  32.  
  33. if (yesbutton)
  34. {
  35. GUI.Box (Rect(0, 0, 100, 100), "Enter \n treasure \n chest");
  36. Destroy(this, 5.0f);
  37. }
  38.  
  39. else if (nobutton)
  40. {
  41. GUI.Box (Rect(0, 0, 100, 100), "You \n cannot \n enter");
  42. Destroy(this, 5.0f);
  43. }
  44.  
  45. else
  46. {
  47. GUI.Box (Rect(0, 0, 100, 100), "Give inventory?");
  48. if (GUI.Button (Rect(25, 25, 50, 30), "Yes"))
  49. {
  50. yesbutton = true;
  51. Debug.Log("True");
  52. }
  53.  
  54. if (GUI.Button (Rect(25, 65, 50, 30), "No"))
  55. {
  56. nobutton = true;
  57. Debug.Log("No");
  58. }
  59. }
  60. GUI.EndGroup ();
  61. }
Add Comment
Please, Sign In to add comment