Пример #1
0
        public void CheckForMatches()
        {
            Traversed.Clear();
            AllMatches.Clear();

            for (int y = 0; y < Board.Rows; y++)
            {
                for (int x = 0; x < Board.Columns; x++)
                {
                    PuzzleOrb orb = GetOrbWithIndex(new Index2D(x, y));
                    if (Traversed.Contains(orb))
                    {
                        continue;
                    }

                    List <List <PuzzleOrb> > matchGroup = new List <List <PuzzleOrb> >();
                    TraverseOrb(orb, matchGroup);

                    if (matchGroup.Count > 0)
                    {
                        List <PuzzleOrb> matchedOrbs = new List <PuzzleOrb>();
                        for (int i = 0; i < matchGroup.Count; i++)
                        {
                            for (int j = 0; j < matchGroup[i].Count; j++)
                            {
                                if (!matchedOrbs.Contains(matchGroup[i][j]))
                                {
                                    matchedOrbs.Add(matchGroup[i][j]);
                                }
                            }
                        }
                        AllMatches.Add(matchedOrbs);
                    }
                }
            }
        }
Пример #2
0
 public void ClearMatches()
 {
     AllMatches.Clear();
 }