jelles

UnityCursus 110713 Block

Jul 14th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Block : MonoBehaviour
  5. {
  6.  
  7.     int life;
  8.  
  9.     // Use this for initialization
  10.     void Start ()
  11.     {
  12.     life = 1;
  13.     }
  14.  
  15.     // Update is called once per frame
  16.     void Update ()
  17.     {
  18.  
  19.     }
  20.  
  21.     public void Hit()
  22.     {
  23.         //life--;
  24.         if( --life <= 0 )
  25.         {
  26.             Destroy( gameObject );
  27.         }
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment