Advertisement
kasru

Raycasting & shop system

Jan 19th, 2013
2,363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
  3.  
  4. var hit : RaycastHit;
  5. var shopOpen : boolean = false;
  6.  
  7. function OnGUI () {
  8.  
  9.     if(shopOpen == true) {
  10.         if (GUI.Button(Rect(10,70,50,30),"Item 1"))
  11.             Debug.Log("You bought an item");
  12.         }
  13. }
  14.  
  15. function Update () {
  16.  
  17.     if(Input.GetMouseButtonDown(0) &&
  18.        collider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit,Mathf.Infinity)) {
  19.                        
  20.         shopOpen = true;            
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement