// check the list of boxes to see if they are on every spot in the pattern
        public bool isComplete(GameBoard board, Box[] boxes)
        {
            // store the number of boxes we match
            int matchCount = 0;

            foreach (Box b in boxes)
            //for (int j = 0; j < numberOfSpotsToCheck; j++)
            {
                for (int i = 0; i < numberOfSpotsToCheck; i++)
                {
                    //if (boxes[j].X == spots[i].X && boxes[j].Y == spots[i].Y)
                    if (b.X == spots[i].X && b.Y == spots[i].Y)
                    {
                        matchCount++;
                    }
                }
            }

            if (matchCount == numberOfSpotsToCheck)
            {
                if (sparkleCount < 75)
                {
                    showSparkles = true;
                    sparkleCount++;
                }
                else if (sparkleCount >= 75)
                {
                    showSparkles = false;
                }
                return true;
            }
            else
            {
                showSparkles = false;
                sparkleCount = 0;
            }
            return false;
        }
Beispiel #2
0
        private void setBoxes()
        {
            Box b1 = new Box(board, 7, 8);
            Box b2 = new Box(board, 13, 8);
            Box b3 = new Box(board, 19, 8);
            Box b4 = new Box(board, 25, 8);
            Box b5 = new Box(board, 10, 10);
            Box b6 = new Box(board, 16, 10);
            Box b7 = new Box(board, 22, 10);

            Box b8 = new Box(board, 7, 13);
            Box b9 = new Box(board, 8, 13);
            Box b10 = new Box(board, 9, 13);
            Box b11 = new Box(board, 10, 13);
            Box b12 = new Box(board, 11, 13);
            Box b13 = new Box(board, 12, 13);
            Box b14 = new Box(board, 13, 13);

            boxes = new Box[14] { b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14 };
        }