Ejemplo n.º 1
0
 private void StartNewGame()
 {
     SetVisibility_Options(Visibility.Hidden);
     SetVisibility_QueryNameAndSpeed(Visibility.Hidden);
     if (!gameStarted)
     {
         _snake = new SnakeModel(_player.speed);
         Grid gameGrid = _snake.GameGrid;
         mainCanvas.Children.Add(gameGrid);
         gameGrid.SetValue(Canvas.LeftProperty, (double)600);
         gameGrid.SetValue(Canvas.TopProperty, (double)20);
         gameGrid.ShowGridLines  = true;
         _snake.myTimer.Elapsed += CheckCandyEaten;
         gameStarted             = true;
     }
     else
     {
         _snake.ChangeSpeed(_player.speed);
     }
     SetVisibility_GameGrid(Visibility.Visible);
     SetVisibility_PauseAndExitButton(Visibility.Visible);
     GenerateNewCandy();
     _snake.TimerBegin();
     CurrentScore = _snake.Length;
 }
Ejemplo n.º 2
0
        public StartGame()
        {
            InitializeComponent();
            var welcomeDialog = new Welcome();

            welcomeDialog.ShowDialog();
            CandyEaten += OnCandyEaten;
            SetStringsAndOptions();
            SetVisibility_Options(Visibility.Visible);
            SetVisibility_QueryNameAndSpeed(Visibility.Hidden);
            _snake = null;
        }
Ejemplo n.º 3
0
 public CandyEventArgs(SnakeModel s) : base()
 {
     Snake = s;
 }