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); }
public void OnCollisionDetected(IMatchableItem <T> other) { if (GameManager.Instance.IsWin) { return; } if (CheckMatch(other)) { OnMatch(other); } }
public abstract void OnMatch(IMatchableItem <T> matchedObject);
public bool CheckMatch(IMatchableItem <T> matchableItem) => Equals((MatchableItemGeneric <T>)matchableItem);