Пример #1
0
        private void GenerateSnake()
        {
            var segment1 = new Segment();

            segment1.Poisition = new Coordinate()
            {
                X = 0, Y = 0
            };
            var segment2 = new Segment();

            segment2.Poisition = new Coordinate()
            {
                X = 0, Y = 1
            };
            var segment3 = new Segment();

            segment3.Poisition = new Coordinate()
            {
                X = 0, Y = 2
            };

            var head = new SnakeHead(segment3);

            var segs = new LinkedList <Segment>();

            segs.AddFirst(segment1);
            segs.AddLast(segment2);
            segs.AddLast(segment3);
            var body = new SnakeBody(segs);

            _model.Snake = new Snake(head, body, new CommandDown());
        }
Пример #2
0
        public Snake(SnakeHead head, SnakeBody body, CommandOrientation command)
        {
            _head    = head;
            _body    = body;
            _command = command;

            _head.SetOwner(this);
            _body.SetOwner(this);
        }