Esempio n. 1
0
        public void Init()
        {
            _scene = new Scene(_width, _height);
            _snake = new Snake(_scene, new Point(_width / 2, _height / 2));

            _scene.GenerateNewFood(_snake);
            _snake.FoodEaten += OnFoodEaten;

            _snap = new SnakePresenter(_snake)
            {
                CanvasHeight = FormHeight,
                CanvasWidth = FormWidth,
                Graphics = g,
                Line = _height,
                Column = _width
            };

            _scep = new ScenePresenter(_scene)
            {
                CanvasHeight = FormHeight,
                CanvasWidth = FormWidth,
                Graphics = g,
                Line = _height,
                Column = _width
            };
        }
Esempio n. 2
0
 public Snake(Scene scene, Point position)
 {
     _direction = (DirectionEnum)(new Random()).Next(4);
     _dead = false;
     _bodyBlock = new List<Point>();
     _bodyBlock.Add(position);
     _scene = scene;
 }
Esempio n. 3
0
 public ScenePresenter(Scene scene)
 {
     _scene = scene;
 }