示例#1
0
 public BotMoving(Food food, List <SnakeElement> player, List <SnakeElement> enemy,
                  Directions enemyDirection, int width, int height, int moveSize)
 {
     this.width            = width;
     this.height           = height;
     this.moveSize         = moveSize;
     this.food             = food;
     snakeBody             = player;
     snakeBodyEnemy        = enemy;
     enemyHead             = enemy[0];
     enemyCurrentDirection = enemyDirection;
 }
示例#2
0
        private void CheckAndIncreaseEnemy(List <SnakeElement> snakebody)
        {
            if (snakebody[0].point == food.point)
            {
                PlaySound("apple.mp3");
                var color    = snakebody[0].rectangle.Fill;
                var newSnake = new SnakeElement(food.point);
                newSnake.rectangle.Fill = color;
                snakebody.Add(newSnake);
                AddFoodInCanvas();
            }

            if (snakebody.Count == 16)
            {
                GameOver("Второй игрок съел 15 яблок!");
            }
        }