コード例 #1
0
        public MyPoint GetNextPoint()

        {
            {
                MyPoint head      = pointList.Last();
                MyPoint nextPoint = new MyPoint(head);
                nextPoint.MovePoint(1, Direction);

                return(nextPoint);
            }
        }
コード例 #2
0
        public Snake(MyPoint tail, int length, Direction _direction)
        {
            Direction = _direction;

            for (int i = 0; i < length; i++)
            {
                MyPoint newPoint = new MyPoint(tail);
                newPoint.MovePoint(i, Direction);
                pointList.Add(newPoint);
            }
        }
コード例 #3
0
        public Snake(MyPoint tail, int length, Color _color, Direction _direction)  //added a new propery named class
        {
            Direction = _direction;
            color     = _color;

            for (int i = 0; i < length; i++)
            {
                MyPoint newPoint = new MyPoint(tail);
                newPoint.MovePoint(i, Direction);
                pointList.Add(newPoint);
            }
        }