public override IEnumerable Regenerate()
        {
            IEnumerator enumerator = base.Regenerate().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object result = enumerator.Current;
                    yield return(result);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            List <Vector3> tmpVerts;
            List <int>     tmpIndices;

            SphereGenerator.Generate(4, 108.1f, Vector3.forward, 360f, out tmpVerts, out tmpIndices);
            LayerSubMesh subMesh = base.GetSubMesh(WorldMaterials.PlanetGlow);

            subMesh.verts.AddRange(tmpVerts);
            subMesh.tris.AddRange(tmpIndices);
            base.FinalizeMesh(MeshParts.All);
            yield break;
        }
Пример #2
0
        public override IEnumerable Regenerate()
        {
            IEnumerator enumerator = base.Regenerate().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object result = enumerator.Current;
                    yield return(result);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            Vector3 planetViewCenter = Find.WorldGrid.viewCenter;
            float   planetViewAngle  = Find.WorldGrid.viewAngle;

            if (planetViewAngle < 180f)
            {
                List <Vector3> collection;
                List <int>     collection2;
                SphereGenerator.Generate(4, 99.85f, -planetViewCenter, 180f - Mathf.Min(planetViewAngle, 180f) + 10f, out collection, out collection2);
                LayerSubMesh subMesh = base.GetSubMesh(WorldMaterials.UngeneratedPlanetParts);
                subMesh.verts.AddRange(collection);
                subMesh.tris.AddRange(collection2);
            }
            base.FinalizeMesh(MeshParts.All);
            yield break;
        }
Пример #3
0
        public override IEnumerable Regenerate()
        {
            IEnumerator enumerator = base.Regenerate().GetEnumerator();

            try
            {
                if (enumerator.MoveNext())
                {
                    object result = enumerator.Current;
                    yield return(result);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            finally
            {
                IDisposable disposable;
                IDisposable disposable2 = disposable = (enumerator as IDisposable);
                if (disposable != null)
                {
                    disposable2.Dispose();
                }
            }
            SphereGenerator.Generate(4, 108.1f, Vector3.forward, 360f, out List <Vector3> tmpVerts, out List <int> tmpIndices);
            LayerSubMesh subMesh = GetSubMesh(WorldMaterials.PlanetGlow);

            subMesh.verts.AddRange(tmpVerts);
            subMesh.tris.AddRange(tmpIndices);
            FinalizeMesh(MeshParts.All);
            yield break;
IL_0137:
            /*Error near IL_0138: Unexpected return in MoveNext()*/;
        }
Пример #4
0
        public override IEnumerable Regenerate()
        {
            foreach (object item in base.Regenerate())
            {
                yield return(item);
            }
            SphereGenerator.Generate(4, 108.1f, Vector3.forward, 360f, out List <Vector3> outVerts, out List <int> outIndices);
            LayerSubMesh subMesh = GetSubMesh(WorldMaterials.PlanetGlow);

            subMesh.verts.AddRange(outVerts);
            subMesh.tris.AddRange(outIndices);
            FinalizeMesh(MeshParts.All);
        }
Пример #5
0
        public override IEnumerable Regenerate()
        {
            foreach (object result in base.Regenerate())
            {
                yield return(result);
            }
            List <Vector3> tmpVerts;
            List <int>     tmpIndices;

            SphereGenerator.Generate(4, 108.1f, Vector3.forward, 360f, out tmpVerts, out tmpIndices);
            LayerSubMesh subMesh = base.GetSubMesh(WorldMaterials.PlanetGlow);

            subMesh.verts.AddRange(tmpVerts);
            subMesh.tris.AddRange(tmpIndices);
            base.FinalizeMesh(MeshParts.All);
        }
        public override IEnumerable Regenerate()
        {
            foreach (object item in base.Regenerate())
            {
                yield return(item);
            }
            Vector3 viewCenter = Find.WorldGrid.viewCenter;
            float   viewAngle  = Find.WorldGrid.viewAngle;

            if (viewAngle < 180f)
            {
                SphereGenerator.Generate(4, 99.85f, -viewCenter, 180f - Mathf.Min(viewAngle, 180f) + 10f, out List <Vector3> outVerts, out List <int> outIndices);
                LayerSubMesh subMesh = GetSubMesh(WorldMaterials.UngeneratedPlanetParts);
                subMesh.verts.AddRange(outVerts);
                subMesh.tris.AddRange(outIndices);
            }
            FinalizeMesh(MeshParts.All);
        }
Пример #7
0
        public override IEnumerable Regenerate()
        {
            foreach (object result in base.Regenerate())
            {
                yield return(result);
            }
            Vector3 planetViewCenter = Find.WorldGrid.viewCenter;
            float   planetViewAngle  = Find.WorldGrid.viewAngle;

            if (planetViewAngle < 180f)
            {
                List <Vector3> collection;
                List <int>     collection2;
                SphereGenerator.Generate(4, 99.85f, -planetViewCenter, 180f - Mathf.Min(planetViewAngle, 180f) + 10f, out collection, out collection2);
                LayerSubMesh subMesh = base.GetSubMesh(WorldMaterials.UngeneratedPlanetParts);
                subMesh.verts.AddRange(collection);
                subMesh.tris.AddRange(collection2);
            }
            base.FinalizeMesh(MeshParts.All);
        }
        public override IEnumerable Regenerate()
        {
            IEnumerator enumerator = base.Regenerate().GetEnumerator();

            try
            {
                if (enumerator.MoveNext())
                {
                    object result = enumerator.Current;
                    yield return(result);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            finally
            {
                IDisposable disposable;
                IDisposable disposable2 = disposable = (enumerator as IDisposable);
                if (disposable != null)
                {
                    disposable2.Dispose();
                }
            }
            Vector3 planetViewCenter = Find.WorldGrid.viewCenter;
            float   planetViewAngle  = Find.WorldGrid.viewAngle;

            if (planetViewAngle < 180.0)
            {
                List <Vector3> collection  = default(List <Vector3>);
                List <int>     collection2 = default(List <int>);
                SphereGenerator.Generate(4, 99.85f, -planetViewCenter, (float)(180.0 - Mathf.Min(planetViewAngle, 180f) + 10.0), out collection, out collection2);
                LayerSubMesh subMesh = base.GetSubMesh(WorldMaterials.UngeneratedPlanetParts);
                subMesh.verts.AddRange(collection);
                subMesh.tris.AddRange(collection2);
            }
            base.FinalizeMesh(MeshParts.All);
            yield break;
IL_0167:
            /*Error near IL_0168: Unexpected return in MoveNext()*/;
        }
Пример #9
0
        public static void Generate(int subdivisionsCount, float radius, Vector3 viewCenter, float viewAngle, out List <Vector3> outVerts, out List <int> outIndices)
        {
            SphereGenerator.middlePointsCache.Clear();
            outVerts = new List <Vector3>();
            IcosahedronGenerator.GenerateIcosahedron(outVerts, SphereGenerator.tris, radius, viewCenter, viewAngle);
            for (int i = 0; i < subdivisionsCount; i++)
            {
                SphereGenerator.newTris.Clear();
                int j     = 0;
                int count = SphereGenerator.tris.Count;
                while (j < count)
                {
                    TriangleIndices triangleIndices = SphereGenerator.tris[j];
                    int             middlePoint     = SphereGenerator.GetMiddlePoint(triangleIndices.v1, triangleIndices.v2, outVerts, radius);
                    int             middlePoint2    = SphereGenerator.GetMiddlePoint(triangleIndices.v2, triangleIndices.v3, outVerts, radius);
                    int             middlePoint3    = SphereGenerator.GetMiddlePoint(triangleIndices.v3, triangleIndices.v1, outVerts, radius);
                    SphereGenerator.newTris.Add(new TriangleIndices(triangleIndices.v1, middlePoint, middlePoint3));
                    SphereGenerator.newTris.Add(new TriangleIndices(triangleIndices.v2, middlePoint2, middlePoint));
                    SphereGenerator.newTris.Add(new TriangleIndices(triangleIndices.v3, middlePoint3, middlePoint2));
                    SphereGenerator.newTris.Add(new TriangleIndices(middlePoint, middlePoint2, middlePoint3));
                    j++;
                }
                SphereGenerator.tris.Clear();
                SphereGenerator.tris.AddRange(SphereGenerator.newTris);
            }
            MeshUtility.RemoveVertices(outVerts, SphereGenerator.tris, (Vector3 x) => !MeshUtility.Visible(x, radius, viewCenter, viewAngle));
            outIndices = new List <int>();
            int k      = 0;
            int count2 = SphereGenerator.tris.Count;

            while (k < count2)
            {
                TriangleIndices triangleIndices2 = SphereGenerator.tris[k];
                outIndices.Add(triangleIndices2.v1);
                outIndices.Add(triangleIndices2.v2);
                outIndices.Add(triangleIndices2.v3);
                k++;
            }
        }