Advertisement
Transformator

Bullet_Unit.js

Dec 21st, 2014
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #pragma strict
  2. /*
  3. * --Bullet_Unit.js
  4. * @author: Paul Scharnofske
  5. * @version: 1.0.0
  6. *
  7. * This Script have to be bound to the bullet witch have to be shoot.
  8. * In this Script the bullet get it's movement and this Script also vanish
  9. * the first bullet (the sample bullet). (its not vanished but hidden
  10. * because of the position)
  11. */
  12.  
  13. // Distance witch the Bullet moves per Frame.
  14. var distance : float = 1.5f;
  15. // Counter to vanish spawnbullet.
  16. var count : int = 0;
  17.  
  18. // Updatefunktion executed every new Frame.
  19. function Update () {
  20. // Let the Bullet move forward. (Here is a mistake)
  21. transform.position = transform.position + transform.forward * distance * Time.deltaTime;
  22.  
  23. // For the first 25 Frames the bullet will vanish (be at a position you can't see it.)
  24. if(count != 25) {
  25. // Moves the Bullet below the Structure.
  26. transform.position.x = -5;
  27. transform.position.y = -5;
  28. transform.position.z = -5;
  29.  
  30. // Resets Rotation.
  31. transform.rotation.x = 0;
  32. transform.rotation.y = 0;
  33. transform.rotation.z = 0;
  34.  
  35. // Count variable "count" up.
  36. count++;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement