Beispiel #1
0
        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);
        }
Beispiel #2
0
        public void OnCollisionDetected(IMatchableItem <T> other)
        {
            if (GameManager.Instance.IsWin)
            {
                return;
            }

            if (CheckMatch(other))
            {
                OnMatch(other);
            }
        }
Beispiel #3
0
 public abstract void OnMatch(IMatchableItem <T> matchedObject);
Beispiel #4
0
 public bool CheckMatch(IMatchableItem <T> matchableItem) => Equals((MatchableItemGeneric <T>)matchableItem);