TeHArGiS10

Untitled

Sep 1st, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #pragma strict
  2.  
  3. var hit : RaycastHit;
  4. var raycastDist : float = 100;
  5. var Gun : GameObject;
  6. var PressE : GameObject;
  7.  
  8. function Start () {
  9. PressE.gameObject.SetActive(false);
  10. }
  11.  
  12. function Update () {
  13. if(Input.GetKey(KeyCode.E)) {
  14. if(Physics.Raycast(transform.position, transform.forward, raycastDist))
  15. Gun.gameObject.SetActive(false);
  16. else
  17. Gun.gameObject.SetActive(true);
  18.  
  19. if(hit.transform.name == ("Table"))
  20. PressE.gameObject.SetActive(true);
  21. else
  22. PressE.gameObject.SetActive(false);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment