Exemple #1
0
 public GameSystem(ref Canvas canvas)
 {
     this.canvas = canvas;
     StopAction += () => { movingTimer.Stop(); };
     OnGameOver += () => { movingTimer.Stop(); };
     State       = new GameSystemDataState();
 }
Exemple #2
0
 private void Window_SaveGame(GameSystemDataState obj)
 {
     if (obj != null)
     {
         Originator.SetMemento(obj);
     }
 }
Exemple #3
0
        private void SetInitialState()
        {
            clearCanvas();
            State = new GameSystemDataState();

            BrickDrawer.DrawGrid(State.bricks, ref canvas);

            Rectangle rectangleRed = (Rectangle)canvas.FindName("rectangleRed");

            double left = Canvas.GetLeft(rectangleRed) + (rectangleRed.ActualWidth / 2);
            double top  = canvas.ActualHeight - 60;

            State.RedGameBallLeft = left;
            State.RedGameBallTop  = top;


            Canvas.SetLeft((Ellipse)canvas.FindName("GameBallRed"), State.RedGameBallLeft);
            Canvas.SetTop((Ellipse)canvas.FindName("GameBallRed"), State.RedGameBallTop);
        }