Example #1
0
 private void RenderChecker(Checker checker)
 {
     DoubleAnimation dbAscendingX =
         new DoubleAnimation(Canvas.GetLeft(checker.ImageFigure), 18 + checker.Position.X * 48,
                             new Duration(TimeSpan.FromMilliseconds(500)));
     DoubleAnimation dbAscendingY =
         new DoubleAnimation(Canvas.GetTop(checker.ImageFigure), 18 + checker.Position.Y * 48,
                             new Duration(TimeSpan.FromMilliseconds(500)));
     Storyboard storyboard = new Storyboard();
     storyboard.Children.Add(dbAscendingX);
     storyboard.Children.Add(dbAscendingY);
     Storyboard.SetTarget(dbAscendingX, checker.ImageFigure);
     Storyboard.SetTarget(dbAscendingY, checker.ImageFigure);
     Storyboard.SetTargetProperty(dbAscendingX, new PropertyPath(Canvas.LeftProperty));
     Storyboard.SetTargetProperty(dbAscendingY, new PropertyPath(Canvas.TopProperty));
     storyboard.Begin();
     storyboard.Completed += delegate
         {
             Canvas.SetLeft(checker.ImageFigure, 18 + checker.Position.X * 48);
             Canvas.SetTop(checker.ImageFigure, 18 + checker.Position.Y * 48);
         };
 }
Example #2
0
 public void BeatSelfChecker(Checker checker)
 {
     CanvasGame.Children.Remove(checker.ImageFigure);
     checkersSelf.Remove(checker);
 }
Example #3
0
 private void BeatenChecker(Checker checker)
 {
     DoubleAnimation dbAscendingX =
         new DoubleAnimation(checker.ImageFigure.Opacity, 0.3,
                             new Duration(TimeSpan.FromMilliseconds(500)));
     Storyboard storyboard = new Storyboard();
     storyboard.Children.Add(dbAscendingX);
     Storyboard.SetTarget(dbAscendingX, checker.ImageFigure);
     Storyboard.SetTargetProperty(dbAscendingX, new PropertyPath(Image.OpacityProperty));
     storyboard.Begin();
     storyboard.Completed += delegate
         {
             checker.ImageFigure.Opacity = 0.3;
         };
 }
Example #4
0
 public void BeatOpponentChecker(Checker checker)
 {
     CanvasGame.Children.Remove(checker.ImageFigure);
     checkersBeaten.Add(checker);
     checkersOpponent.Remove(checker);
 }