Guest User

Untitled

a guest
May 17th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var beenhit = 0;
  2.  
  3.  
  4. function OnControllerColliderHit (hit : ControllerColliderHit) {   
  5.     if (hit.gameObject.tag == "bullet") {
  6.         beenhit++;
  7.         Debug.Log("Been HIT!");
  8.     }
  9. }
  10.    
  11. function Update() {
  12. Debug.Log("beenhit: " + beenhit);
  13.     if (beenhit > 5) {
  14.             Debug.Log("hit more than 5 times!");
  15.         Destroy(gameObject);
  16.         }
  17. }
Add Comment
Please, Sign In to add comment