public void DeductHealth(int x) { for (int i = 0; i < x; i++) { mFilled[mIndex].enabled = false; mIndex--; if (mIndex < 0) { // Kill Megaman mMegaMan.Die(); break; } } }
// Use this for initialization void Start() { zombie zombie = new zombie(); player player = new player(); player.TakeDamage(zombie.Attack()); player.TakeDamage(zombie.AcidPukeAttack()); player.Die(); zombie[] zombies = new zombie[100]; for (int i = 0; i < zombies.Length; i++) { zombies[i] = new zombie(); Debug.Log("Creating Zombie #:" + i); } }
void OnCollisionEnter(Collision collision) { Collider collider = collision.collider; if (collider.CompareTag("Fplayer")) { player e1 = collider.gameObject.GetComponent <player>(); e1.Die(); Destroy(gameObject); } if (collider.CompareTag("bunker")) { bunker eb = collider.gameObject.gameObject.GetComponent <bunker>(); eb.Die(); Destroy(gameObject); } else { Destroy(gameObject); } }