private bool TryGetIMatchable(Collision2D other, out IMatchableItem <T> otherMatchable) { if (!other.gameObject.CompareTag(TagsNames.GetTag(comparingTag))) { otherMatchable = null; return(false); } otherMatchable = other.transform.GetComponent <IMatchableItem <T> >(); return(true); }
private void OnTriggerEnter2D(Collider2D other) { if (!other.gameObject.CompareTag(TagsNames.GetTag(comparingTag))) { return; } var parent = other.transform.parent; if (parent) { parent.gameObject.PushBackToPool(); } else { other.gameObject.PushBackToPool(); } }