Update() защищенный Метод

protected Update ( GameTime gameTime ) : void
gameTime GameTime
Результат void
Пример #1
0
        static void StartGameLoop()
        {
            while (true)
            {
                graphics.Clear();

                game.Update();
                //draw food
                graphics.DrawPixel(game.FoodPosition.X, game.FoodPosition.Y);

                //draw food
                for (int i = 0; i < game.SnakePosition.Count; i++)
                {
                    var point = (Point)game.SnakePosition[i];

                    graphics.DrawPixel(point.X, point.Y);
                }

                if (game.PlaySound)
                {
                    speaker.PlayTone(440, 25);
                }

                //show
                graphics.Show();

                Thread.Sleep(250 - game.Level * 5);
            }
        }
Пример #2
0
        /// <summary>
        /// Aktualizovanie hracieho pola.
        /// </summary>
        private void RefreshGameField()
        {
            if (!game.Update())
            {
                Pause();
            }
            gameTimerSnake.Interval = TimeSpan.FromMilliseconds(game.SpeedMS);

            for (int x = 0; x < game.GameField.GetRectanglesOnWidth(); x++)
            {
                for (int y = 0; y < game.GameField.GetRectanglesOnHeight(); y++)
                {
                    Canvas.SetLeft(game.GameField.gameField[x, y].Rect, game.GameField.gameField[x, y].Coordinates.X * CubeWidth);
                    Canvas.SetTop(game.GameField.gameField[x, y].Rect, (game.GameField.gameField[x, y].Coordinates.Y * CubeHeight) + CubeHeight);
                }
            }
        }
Пример #3
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     snakeGame.Update();
     pictureBox1.Refresh();
 }