Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

i'm beginner in unity ! my problem is i can't count the number of zombie killed ! this script ZombieHelath is attached to zombie , i'm using javascript !Please help

$
0
0
#pragma strict var ZombieHealth : int = 100 ; function OnCollisionEnter (col : Collision) { if ( col.gameObject.tag == "Bullet") { ZombieHealth -= 25 ; } } function Update () { if ( ZombieHealth <= 0 ) { GetComponent.().Play("back_fall"); gameObject.GetComponent(ZombieAI).enabled = false ; gameObject.GetComponent(CharacterController).enabled = false; Dead () ; } } function Dead () { yield WaitForSeconds (5) ; Destroy ( gameObject) ; }

Viewing all articles
Browse latest Browse all 187

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>