Exemplo n.º 1
0
 public Collision(Snake snake, Apple apple, PinkApple pinkApple, Vector playgroundDimensions)
 {
     this.snake                = snake;
     this.apple                = apple;
     this.pinkApple            = pinkApple;
     this.playgroundDimensions = playgroundDimensions;
 }
Exemplo n.º 2
0
        public void NewGame(IRenderer renderer)
        {
            playTimer.Reset();
            renderer.ClearScreen();
            DirectionControl.ResetDirection();
            score.ResetScore();

            new FieldBorder(renderer, (int)playgroundDimension.X, (int)playgroundDimension.Y);

            var snakeStartPoint = new Vector(playgroundDimension.X / 2 * Measure, playgroundDimension.Y / 2 * Measure);

            snake = new Snake(snakeStartPoint, renderer);

            apple = new Apple(ColorThemes.Apple);
            renderer.RenderObject(apple.GetShape());

            pinkApple = new PinkApple(ColorThemes.PinkApple);
            renderer.RenderObject(pinkApple.GetShape());

            collision = new Collision(snake, apple, pinkApple, playgroundDimension);

            apple.SetCollision(collision);
            apple.ReplaceApple();

            pinkApple.SetCollision(collision);
            pinkApple.HideApple();

            ResumeGame();
            guiClient.SetVisibilityOfResume(true);
        }