Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #pragma strict
  2. //object1 is a placeholder where the weapons are instatiated
  3. var object1 : GameObject;
  4. //object2 is a object(weapon)
  5. var object2 : GameObject;
  6. //object3 is the second object
  7. var object3 : GameObject;
  8. function Update () {
  9. //left MouseButton
  10. if (Input.GetMouseButtonDown (0)) {
  11. Instantiate(object2,object1.transform.position,object1.transform.rotation);
  12. Destroy (object3);
  13. }
  14. //Right Mousebutton
  15. if (Input.GetMouseButtonDown (1)) {
  16. Instantiate(object3,object1.transform.position,object1.transform.rotation);
  17. Destroy (object2);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement