Advertisement
Guest User

script1

a guest
Oct 7th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #pragma strict
  2.  
  3. var openable : boolean = false;
  4. static var opened;
  5.  
  6. var isOpened : boolean = false;
  7.  
  8. function Start () {
  9.  
  10. opened = isOpened;
  11.  
  12. }
  13.  
  14. function OnTriggerEnter (){
  15.  
  16. openable = true;
  17. }
  18.  
  19. function OnTriggerExit (){
  20.  
  21. openable = false;
  22. }
  23.  
  24. function Update () {
  25.  
  26. if (Input.GetMouseButton(0) && openable == true){
  27.  
  28. animation.Play("SwitchOn");
  29. isOpened = true;
  30.  
  31.  
  32. }
  33.  
  34. }
  35.  
  36. function OnGUI () {
  37.  
  38. if( isOpened == false && openable == true)
  39. GUI.TextArea(Rect ((Screen.width /2) - 50, (Screen.height /2) - 50, 150,20),"Press Click To Activate");
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement