ren811

ColisorTigela.cs

Dec 13th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ColisorTigela : MonoBehaviour {
  5.    
  6.     // Use this for initialization
  7.     void Start ()
  8.     {
  9.        
  10.     }
  11.    
  12.     // Update is called once per frame
  13.     void Update ()
  14.     {
  15.         if (gameObject.transform.position.z < Camera.main.transform.position.z)
  16.         {
  17.             DestroyThis();
  18.         }
  19.     }
  20.    
  21.     void OnCollisionEnter(Collision collision)
  22.     {
  23.         DestroyThis();
  24.     }
  25.    
  26.     void DestroyThis()
  27.     {
  28.         Destroy (gameObject);
  29.         Destroy (this);
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment