private List <Vector3> GenerateVertex()
        {
            //store all vertices point
            List <Vector3> vertices = new List <Vector3>();

            for (int i = 0; i <= PolyCount; i++)
            {
                float time      = i / (float)PolyCount;
                float next_time = (i + 1) / (float)PolyCount > (float)PolyCount ? time : (i + 1) / (float)PolyCount;

                Vector3    point = GetBezier_Point(time);
                Quaternion rot   = GetBezierOrientation(time);

                Vector3    nextPointb = GetBezier_Point(next_time);
                Quaternion nextRot    = GetBezierOrientation(next_time);

                MeshShape A = new MeshShape(point, rot, 5);          //first root point vertex points
                MeshShape B = new MeshShape(nextPointb, nextRot, 5); //next root point vertex points


                List <Vector3> TileShape = MeshShape.AddShape(A, B);
                vertices.AddRange(TileShape);
            }
            return(vertices);
        }
        private void Update()
        {
            List <Vector3> vertices = new List <Vector3>();

            vertices = GenerateVertex();               //create vertex W.T.To Beziercurve path

            MeshShape MainShape = new MeshShape();     //create shape object

            MainShape.meshData.SetVertices = vertices; //set vertices into the MainShape object that will generate visible mesh

            Mesh mesh = MainShape.meshData.Mesh;

            GetComponent <MeshFilter>().sharedMesh = mesh;
        }
        public static List <Vector3> AddShape(MeshShape A, MeshShape B)
        {
            List <Vector3> vertices = new List <Vector3>();

            //left side edge
            List <Vector3> subquad = GetRectVertex(A.LeftBottom, B.LeftBottom, B.LeftTop, A.LeftTop);

            vertices.AddRange(subquad);

            //right side adge
            subquad = GetRectVertex(A.RightTop, B.RightTop, B.RightBottom, A.RightBottom);
            vertices.AddRange(subquad);

            //road surfce
            subquad = GetRectVertex(A.Inner_LeftBottom, B.Inner_LeftBottom, B.Inner_RightBottom, A.Inner_RightBottom);
            vertices.AddRange(subquad);

            //left footpath
            subquad = GetRectVertex(A.LeftTop, B.LeftTop, B.Inner_LeftTop, A.Inner_LeftTop);
            vertices.AddRange(subquad);


            //right footpath
            subquad = GetRectVertex(A.Inner_RightTop, B.Inner_RightTop, B.RightTop, A.RightTop);
            vertices.AddRange(subquad);


            //left border
            subquad = GetRectVertex(A.Inner_LeftTop, B.Inner_LeftTop, B.Inner_LeftBottom, A.Inner_LeftBottom);
            vertices.AddRange(subquad);


            //right border
            subquad = GetRectVertex(A.Inner_RightBottom, B.Inner_RightBottom, B.Inner_RightTop, A.Inner_RightTop);
            vertices.AddRange(subquad);

            return(vertices);
        }