void CheckExplosiveMushroomTrigger(Collider2D collision) { ExplosiveMushroom mushroom = collision.gameObject.GetComponent <ExplosiveMushroom>(); if (!mushroom) { return; } ActivateMushroom(mushroom); }
void ActivateMushroom(ExplosiveMushroom mushroom) { mushroom.Activate(); Destroy(this.gameObject); }