private void OnTriggerEnter(Collider other) { if ((other.CompareTag("EnemyBullet") || other.CompareTag("AliveEnemy")) && !invincible) { hp--; invincible = true; } if (hp <= 0) { SceneScript.LoseState(); } for (int i = 0; i < hearts.Length; i++) { if (i < hp) { hearts[i].sprite = heartSprite; } else { hearts[i].sprite = null; } } }