示例#1
0
        public override void Regenerate()
        {
            if (MatBases.SunShadow.shader.isSupported)
            {
                LayerSubMesh subMesh = base.GetSubMesh(MatBases.IndoorMask);
                subMesh.Clear(MeshParts.All);
                Building[] innerArray = base.Map.edificeGrid.InnerArray;
                CellRect   cellRect   = new CellRect(base.section.botLeft.x, base.section.botLeft.z, 17, 17);
                cellRect.ClipInsideMap(base.Map);
                subMesh.verts.Capacity = cellRect.Area * 2;
                subMesh.tris.Capacity  = cellRect.Area * 4;
                float       y           = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays);
                CellIndices cellIndices = base.Map.cellIndices;
                for (int i = cellRect.minX; i <= cellRect.maxX; i++)
                {
                    for (int j = cellRect.minZ; j <= cellRect.maxZ; j++)
                    {
                        IntVec3 intVec = new IntVec3(i, 0, j);
                        if (!this.HideRainPrimary(intVec))
                        {
                            bool flag  = intVec.Roofed(base.Map);
                            bool flag2 = false;
                            if (flag)
                            {
                                for (int k = 0; k < 8; k++)
                                {
                                    IntVec3 c = intVec + GenAdj.AdjacentCells[k];
                                    if (c.InBounds(base.Map) && this.HideRainPrimary(c))
                                    {
                                        flag2 = true;
                                        break;
                                    }
                                }
                            }
                            if (flag && flag2)
                            {
                                goto IL_016e;
                            }
                            continue;
                        }
                        goto IL_016e;
IL_016e:
                        Thing thing = innerArray[cellIndices.CellToIndex(i, j)];
                        float num = (float)((thing == null || (thing.def.passability != Traversability.Impassable && !thing.def.IsDoor)) ? 0.15999999642372131 : 0.0);
                        subMesh.verts.Add(new Vector3((float)i - num, y, (float)j - num));
                        subMesh.verts.Add(new Vector3((float)i - num, y, (float)(j + 1) + num));
                        subMesh.verts.Add(new Vector3((float)(i + 1) + num, y, (float)(j + 1) + num));
                        subMesh.verts.Add(new Vector3((float)(i + 1) + num, y, (float)j - num));
                        int count = subMesh.verts.Count;
                        subMesh.tris.Add(count - 4);
                        subMesh.tris.Add(count - 3);
                        subMesh.tris.Add(count - 2);
                        subMesh.tris.Add(count - 4);
                        subMesh.tris.Add(count - 2);
                        subMesh.tris.Add(count - 1);
                    }
                }
                if (subMesh.verts.Count > 0)
                {
                    subMesh.FinalizeMesh(MeshParts.Verts | MeshParts.Tris);
                }
            }
        }
示例#2
0
 internal bool <> m__0(IntVec3 x)
 {
     return(x.Roofed(this.map));
 }
 internal bool <> m__0(IntVec3 x)
 {
     return((x.Roofed(this.map) || x == this.c || (this.assumeNonNoRoofCellsAreRoofed && !this.map.areaManager.NoRoof[x])) && x.InHorDistOf(this.c, 6.9f));
 }