Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // collision
- #pragma strict
- var speed : float;
- var minDistance : float;
- var explosion : GameObject;
- function Update () {
- transform.Translate (-Vector3.forward * speed * Time.deltaTime, Space.World);
- if (transform.position.z <= minDistance)
- Destroy (gameObject);
- }
- function OnCollisionEnter(collision : Collision) {
- Instantiate (explosion, transform.position, transform.rotation);
- Destroy (collision.gameObject);
- Destroy (gameObject);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement