void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "Projectile") { Instantiate(DeathParticleEffect, transform.position, Quaternion.identity); gameControl.PlayAudioClip(clip); gameControl.DamageNPC(this.gameObject, npcPoints, gameControl.GetPlayerDamage(), ref npcHealth); Destroy(col.transform.parent.gameObject); } }
void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "Player") { NpcDeathEffect(); gameControl.DamagePlayer(npcDamage); gameControl.AddPoints(npcSpeed); Destroy(this.gameObject, 0.1f); // added this small amount of time makes such a difference } else if (col.gameObject.tag == "Projectile") { gameControl.DamageNPC(this.gameObject, npcPoints, gameControl.GetPlayerDamage(), ref npcHealth); Destroy(col.transform.parent.gameObject); } }