예제 #1
0
        public static Polygon PolygonWithSource(PolygonSource polygonSource)
        {
            Polygon rootPolygon = Polygon.PolygonWithPointTransforms(polygonSource.pointTransforms, polygonSource.windingDirection);

            // Collect sub-olygons if any.
            foreach (Transform eachChildTransform in polygonSource.gameObject.transform)
            {
                GameObject    eachChildGameObject    = eachChildTransform.gameObject;
                PolygonSource eachChildPolygonSource = eachChildGameObject.GetComponent <PolygonSource>();
                if (eachChildPolygonSource != null)
                {
                    Polygon eachSubPolygon = Polygon.PolygonWithSource(eachChildPolygonSource);
                    eachChildPolygonSource.polygon = eachSubPolygon;                     // Inject into source
                    rootPolygon.AddPolygon(eachSubPolygon);
                }
            }

            return(rootPolygon);
        }
예제 #2
0
        /*
         *
         * Model updates
         *
         */

        public void UpdatePointPositionsWithSource(PolygonSource polygonSource)         // Assuming unchanged point count
        {
            UpdatePointPositionsWithTransforms(polygonSource.pointTransforms);
        }