#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) ;
}
↧