public void HouseTakeHit(int damage) { houseHP -= damage; float hpPercentage = ((float)houseHP / (float)houseMaxHP) * 100f; if (hpPercentage <= 75 && hpPercentage > 50 && destructionLevel == 0) { houseScript.ActivateDestroyParticle(); destructionLevel++; } else if (hpPercentage <= 50 && hpPercentage > 25 && (destructionLevel == 0 || destructionLevel == 1)) { if (destructionLevel == 0) { houseScript.ActivateDestroyParticle(); destructionLevel++; } houseScript.ActivateDestroyParticle(); houseScript.DestroyHouse(); destructionLevel++; } else if (hpPercentage <= 25 && (destructionLevel == 0 || destructionLevel == 1 || destructionLevel == 2)) { if (destructionLevel == 0) { houseScript.ActivateDestroyParticle(); destructionLevel++; houseScript.ActivateDestroyParticle(); houseScript.DestroyHouse(); destructionLevel++; } if (destructionLevel == 1) { houseScript.ActivateDestroyParticle(); houseScript.DestroyHouse(); destructionLevel++; } houseScript.ActivateDestroyParticle(); } if (houseHP <= 0 && !gameOver) { gameOver = true; houseHP = 0; StartCoroutine("GameOver"); } UpdateHouseHP(); }