daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest May 17th, 2018 106 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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top