예제 #1
0
        // the starting animation(ready go)
        protected void startAnimation()
        {
            int timeStart = 10;
            int timeStep  = 1000;
            int timeDelay = timeStep + 100;


            welcomeString1 = new StringGrid("READY", SquareGenerator.squareSize / 1.8);

            Canvas.SetLeft(welcomeString1,
                           (Styles.WindowSizeGenerator.screenWidth - welcomeString1.getWidth()) / 2);
            Canvas.SetTop(welcomeString1,
                          (outerGrid.Height - welcomeString1.getHeight()) / 2);
            Canvas.SetZIndex(welcomeString1, 10);

            aCanvas.Children.Add(welcomeString1);
            welcomeString1.startAnimation(timeStep, timeStart);

            Console.WriteLine(outerGrid.Width);
            Console.WriteLine(welcomeString1.getWidth());
            Console.WriteLine((holderWin.Width - welcomeString1.getWidth()) / 2);

            welcomeString2 = new StringGrid("GO", SquareGenerator.squareSize);
            Canvas.SetLeft(welcomeString2,
                           (Styles.WindowSizeGenerator.screenWidth - welcomeString2.getWidth()) / 2);
            Canvas.SetTop(welcomeString2,
                          (holderWin.Height - welcomeString2.getHeight()) / 2);
            Canvas.SetZIndex(welcomeString2, 10);

            aCanvas.Children.Add(welcomeString2);
            welcomeString2.startAnimation(timeStep, timeDelay + timeStart);

            welcomeString2.story.Completed += whatHappenWhenAnimationStop;


            welcomeString1.beginAnimation();
            welcomeString2.beginAnimation();

            gameOver = new StringGrid("Game Over", SquareGenerator.squareSize / 2.5);

            aCanvas.Children.Add(gameOver);

            Canvas.SetLeft(gameOver,
                           (Styles.WindowSizeGenerator.screenWidth - gameOver.getWidth()) / 2);
            Canvas.SetTop(gameOver,
                          (outerGrid.Height - gameOver.getHeight()) / 2);
            Canvas.SetZIndex(gameOver, 10);

            gameOver.startAnimation(1500, 0);
        }
예제 #2
0
 // show the animation when the game is over
 protected void gameEnd(object sender, EventArgs e)
 {
     gameOver.story.Completed += showExitLog;
     gameOver.beginAnimation();
 }