示例#1
0
        private void ResetBoardLocations()
        {
            // We reset the score counter
            scoreCounter.Reset();

            // Initialize the Board Locations
            for (int i = 0; i < 13; i++)
            {
                for (int j = 0; j < 27; j++)
                {
                    bl[i, j] = new BoardLocation(gamePath[i, j]);

                    // place the location if we have a dot
                    if (gamePath[i, j] == 1 || gamePath[i, j] == 2 || gamePath[i, j] == 3)
                    {
                        gameBoard.Children.Add(bl[i, j]);
                        Canvas.SetTop(bl[i, j], 42 * i);
                        Canvas.SetLeft(bl[i, j], 42 * j);

                        if (gamePath[i, j] == 3)
                        {
                            Ghost ghost = new Ghost();
                            gameBoard.Children.Add(ghost);

                            Canvas.SetTop(ghost, 42 * i);
                            Canvas.SetLeft(ghost, 42 * j);

                            ghost.StartTimer();
                        }
                    }
                }
            }
        }