private void OnCollisionEnter2D(Collision2D other) { int layer = other.gameObject.layer; //Tiny meteors destroys each other when hit if (gameObject.tag == "MeteorTiny" && other.gameObject.tag != "MeteorSmall") { DestroyMeteorTiny(); return; } //Ground collision of meteors if (layer == LayerMask.NameToLayer("Ground")) { animator.SetInteger("State", 1); gameObject.GetComponent <PolygonCollider2D>().enabled = false; r2d.velocity = Vector2.zero; if (gameObject.tag != "MeteorTiny") { GlobalController.ShakeGround(); GlobalController.ChangeResource(ResourceUnits); GlobalController.ChangeGroundIntegrity(-Damage); sFX.PlayOneShot(AtmAudio, 0.6f); } Destroy(gameObject, 2); return; } if (layer == LayerMask.NameToLayer("Towers")) { Physics2D.IgnoreCollision(other.collider, gameObject.GetComponent <Collider2D>()); } }