コード例 #1
0
ファイル: Polygon.cs プロジェクト: wengh/Unity.Library.eppz
        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
ファイル: Polygon.cs プロジェクト: wengh/Unity.Library.eppz
        /*
         *
         * Model updates
         *
         */

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