public void Clear() { int num = CellIndicesUtility.CellToIndex(IntVec3.Invalid, this.mapSizeX); for (int i = 0; i < this.grid.Length; i++) { this.grid[i] = num; } }
public bool this[IntVec3 c] { get { return(this.arr[CellIndicesUtility.CellToIndex(c, this.mapSizeX)]); } set { this.Set(c, value); } }
public void DebugDraw() { for (int i = 0; i < grid.Length; i++) { int num = grid[i]; if (num > 0) { CellRenderer.RenderCell(CellIndicesUtility.IndexToCell(i, mapSizeX), (float)(num % 100) / 100f * 0.5f); } } }
public void DebugDraw() { for (int i = 0; i < grid.Length; i++) { byte b = grid[i]; if (b > 0) { CellRenderer.RenderCell(CellIndicesUtility.IndexToCell(i, mapSizeX), (float)(int)b / 255f * 0.5f); } } }
public int this[int x, int z] { get { return(this.grid[CellIndicesUtility.CellToIndex(x, z, this.mapSizeX)]); } set { this.grid[CellIndicesUtility.CellToIndex(x, z, this.mapSizeX)] = value; } }
public IntVec3 this[int index] { get { return(CellIndicesUtility.IndexToCell(this.grid[index], this.mapSizeX)); } set { this.grid[index] = CellIndicesUtility.CellToIndex(value, this.mapSizeX); } }
public bool this[int x, int z] { get { return(this.arr[CellIndicesUtility.CellToIndex(x, z, this.mapSizeX)]); } set { this.Set(CellIndicesUtility.CellToIndex(x, z, this.mapSizeX), value); } }
public byte this[int x, int z] { get { return(grid[CellIndicesUtility.CellToIndex(x, z, mapSizeX)]); } set { grid[CellIndicesUtility.CellToIndex(x, z, mapSizeX)] = value; } }
public void DebugDraw() { for (int i = 0; i < this.grid.Length; i++) { int num = this.grid[i]; if (num > 0) { IntVec3 c = CellIndicesUtility.IndexToCell(i, this.mapSizeX); CellRenderer.RenderCell(c, (float)((float)(num % 100) / 100.0 * 0.5)); } } }
public int this[IntVec3 c] { get { return(this.grid[CellIndicesUtility.CellToIndex(c, this.mapSizeX)]); } set { int num = CellIndicesUtility.CellToIndex(c, this.mapSizeX); this.grid[num] = value; } }
public byte this[IntVec3 c] { get { return(grid[CellIndicesUtility.CellToIndex(c, mapSizeX)]); } set { int num = CellIndicesUtility.CellToIndex(c, mapSizeX); grid[num] = value; } }
public void DebugDraw() { for (int i = 0; i < this.grid.Length; i++) { byte b = this.grid[i]; if (b > 0) { IntVec3 c = CellIndicesUtility.IndexToCell(i, this.mapSizeX); CellRenderer.RenderCell(c, (float)b / 255f * 0.5f); } } }
private bool CellBoolDrawerGetBoolInt(int index) { IntVec3 c = CellIndicesUtility.IndexToCell(index, map.Size.x); if (c.Filled(map) || c.Fogged(map)) { return(false); } TerrainAffordanceDef affordance; return(TryGetAffordanceDefToDraw(TerrainAt(index), out affordance)); }
public IntVec3 this[int x, int z] { get { int num = CellIndicesUtility.CellToIndex(x, z, this.mapSizeX); return(CellIndicesUtility.IndexToCell(this.grid[num], this.mapSizeX)); } set { int num = CellIndicesUtility.CellToIndex(x, z, this.mapSizeX); this.grid[num] = CellIndicesUtility.CellToIndex(x, z, this.mapSizeX); } }
public IntVec3 this[IntVec3 c] { get { int num = CellIndicesUtility.CellToIndex(c, this.mapSizeX); return(CellIndicesUtility.IndexToCell(this.grid[num], this.mapSizeX)); } set { int num = CellIndicesUtility.CellToIndex(c, this.mapSizeX); this.grid[num] = CellIndicesUtility.CellToIndex(value, this.mapSizeX); } }
public override void Regenerate() { ClearSubMeshes(MeshParts.All); foreach (IntVec3 item in section.CellRect) { List <Thing> list = base.Map.thingGrid.ThingsListAt(item); int count = list.Count; for (int i = 0; i < count; i++) { Thing thing = list[i]; if ((thing.def.seeThroughFog || !base.Map.fogGrid.fogGrid[CellIndicesUtility.CellToIndex(thing.Position, base.Map.Size.x)]) && thing.def.drawerType != 0 && (thing.def.drawerType != DrawerType.RealtimeOnly || !requireAddToMapMesh) && (!(thing.def.hideAtSnowDepth < 1f) || !(base.Map.snowGrid.GetDepth(thing.Position) > thing.def.hideAtSnowDepth)) && thing.Position.x == item.x && thing.Position.z == item.z) { TakePrintFrom(thing); } } } FinalizeMesh(MeshParts.All); }
public IntVec3 IndexToCell(int ind) { return(CellIndicesUtility.IndexToCell(ind, this.mapSizeX)); }
public int CellToIndex(int x, int z) { return(CellIndicesUtility.CellToIndex(x, z, this.mapSizeX)); }
public int CellToIndex(IntVec3 c) { return(CellIndicesUtility.CellToIndex(c, this.mapSizeX)); }
public void RegenerateMesh() { for (int i = 0; i < meshes.Count; i++) { meshes[i].Clear(); } int num = 0; int num2 = 0; if (meshes.Count < num + 1) { Mesh mesh = new Mesh(); mesh.name = "CellBoolDrawer"; meshes.Add(mesh); } Mesh mesh2 = meshes[num]; CellRect cellRect = new CellRect(0, 0, mapSizeX, mapSizeZ); float y = AltitudeLayer.MapDataOverlay.AltitudeFor(); bool careAboutVertexColors = false; for (int j = cellRect.minX; j <= cellRect.maxX; j++) { for (int k = cellRect.minZ; k <= cellRect.maxZ; k++) { int arg = CellIndicesUtility.CellToIndex(j, k, mapSizeX); if (!cellBoolGetter(arg)) { continue; } verts.Add(new Vector3(j, y, k)); verts.Add(new Vector3(j, y, k + 1)); verts.Add(new Vector3(j + 1, y, k + 1)); verts.Add(new Vector3(j + 1, y, k)); Color color = extraColorGetter(arg); colors.Add(color); colors.Add(color); colors.Add(color); colors.Add(color); if (color != Color.white) { careAboutVertexColors = true; } int count = verts.Count; tris.Add(count - 4); tris.Add(count - 3); tris.Add(count - 2); tris.Add(count - 4); tris.Add(count - 2); tris.Add(count - 1); num2++; if (num2 >= 16383) { FinalizeWorkingDataIntoMesh(mesh2); num++; if (meshes.Count < num + 1) { Mesh mesh3 = new Mesh(); mesh3.name = "CellBoolDrawer"; meshes.Add(mesh3); } mesh2 = meshes[num]; num2 = 0; } } } FinalizeWorkingDataIntoMesh(mesh2); CreateMaterialIfNeeded(careAboutVertexColors); dirty = false; }
public void RegenerateMesh() { for (int i = 0; i < this.meshes.Count; i++) { this.meshes[i].Clear(); } int num = 0; int num2 = 0; if (this.meshes.Count < num + 1) { Mesh mesh = new Mesh(); mesh.name = "CellBoolDrawer"; this.meshes.Add(mesh); } Mesh mesh2 = this.meshes[num]; CellRect cellRect = new CellRect(0, 0, this.mapSizeX, this.mapSizeZ); float y = AltitudeLayer.MapDataOverlay.AltitudeFor(); bool careAboutVertexColors = false; for (int j = cellRect.minX; j <= cellRect.maxX; j++) { for (int k = cellRect.minZ; k <= cellRect.maxZ; k++) { int index = CellIndicesUtility.CellToIndex(j, k, this.mapSizeX); if (this.giver.GetCellBool(index)) { CellBoolDrawer.verts.Add(new Vector3((float)j, y, (float)k)); CellBoolDrawer.verts.Add(new Vector3((float)j, y, (float)(k + 1))); CellBoolDrawer.verts.Add(new Vector3((float)(j + 1), y, (float)(k + 1))); CellBoolDrawer.verts.Add(new Vector3((float)(j + 1), y, (float)k)); Color cellExtraColor = this.giver.GetCellExtraColor(index); CellBoolDrawer.colors.Add(cellExtraColor); CellBoolDrawer.colors.Add(cellExtraColor); CellBoolDrawer.colors.Add(cellExtraColor); CellBoolDrawer.colors.Add(cellExtraColor); if (cellExtraColor != Color.white) { careAboutVertexColors = true; } int count = CellBoolDrawer.verts.Count; CellBoolDrawer.tris.Add(count - 4); CellBoolDrawer.tris.Add(count - 3); CellBoolDrawer.tris.Add(count - 2); CellBoolDrawer.tris.Add(count - 4); CellBoolDrawer.tris.Add(count - 2); CellBoolDrawer.tris.Add(count - 1); num2++; if (num2 >= 16383) { this.FinalizeWorkingDataIntoMesh(mesh2); num++; if (this.meshes.Count < num + 1) { Mesh mesh3 = new Mesh(); mesh3.name = "CellBoolDrawer"; this.meshes.Add(mesh3); } mesh2 = this.meshes[num]; num2 = 0; } } } } this.FinalizeWorkingDataIntoMesh(mesh2); this.CreateMaterialIfNeeded(careAboutVertexColors); this.dirty = false; }
public virtual void Set(IntVec3 c, bool value) { this.Set(CellIndicesUtility.CellToIndex(c, this.mapSizeX), value); }