void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.name == "Projectile(Clone)") { ScoreScript.Add(); health--; col.gameObject.GetComponent <Projectile>().onDeath(); if (health == 0) { onDeath(); } } }
private void Die() { AudioSource.PlayClipAtPoint(deathSfx, this.transform.position); scoreInstance.Add(1); Destroy(gameObject); }