public void ReceiveDamage() { if (enemyHealth > 1) { enemyHealth -= 1; ui.IncomeScore(10); } else { Destroy(gameObject); FindObjectOfType <Waves>().onlineEnemies--; ui.IncomeScore(1000); } }