TeHArGiS10

Untitled

Jul 1st, 2014
210
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 KeyIsPressed = false;
  4. var gun1 : GameObject;
  5. var gun2 : GameObject;
  6.  
  7. function Update () {
  8. if(Input.GetKeyDown(KeyCode.E)){
  9. if(KeyIsPressed)
  10. KeyIsPressed = false;
  11. else
  12. KeyIsPressed = true;
  13. }
  14. if(KeyIsPressed) {
  15. gun1.gameObject.SetActive(false);
  16. gun2.gameObject.SetActive(true);
  17. }
  18. if(!KeyIsPressed) {
  19. gun1.gameObject.SetActive(true);
  20. gun2.gameObject.SetActive(false);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment