protected virtual void OnTriggerEnter2D(Collider2D collision) { Player player = collision.GetComponent <Player>(); if (player != null) { player.ChangeHp(-dmg); if (specialEffect) { ItemManager.Instance.ApplyItem(player, itemId.Id); } Destroy(gameObject); } Nexus nexus = collision.GetComponent <Nexus>(); if (nexus) { nexus.DamageNexus(dmg); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { Player player = collision.GetComponent <Player>(); if (player != null) { player.ChangeHp(-dmg); } Nexus nexus = collision.GetComponent <Nexus>(); if (nexus) { nexus.DamageNexus(dmg); } }