private void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.gameObject.tag == "Enemy") { AudioSource audioSource = gameObject.GetComponent <AudioSource>(); audioSource.Play(); if (health > 0) { health -= 10; } if (health <= 0) { health = 0; alive = false; gameObject.GetComponent <SpriteRenderer>().sprite = deathSprite; audioSource.mute = true; this.enabled = false; gameState.GameOver(); } } }