Advertisement
LittleAngel

Untitled

Sep 27th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. // collision
  2.  
  3. #pragma strict
  4.  
  5. var speed : float;
  6. var minDistance : float;
  7. var explosion : GameObject;
  8.  
  9. function Update () {
  10. transform.Translate (-Vector3.forward * speed * Time.deltaTime, Space.World);
  11.  
  12. if (transform.position.z <= minDistance)
  13. Destroy (gameObject);
  14. }
  15.  
  16. function OnCollisionEnter(collision : Collision) {
  17. Instantiate (explosion, transform.position, transform.rotation);
  18. Destroy (collision.gameObject);
  19. Destroy (gameObject);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement