public void DrawDynamicThings() { if (!DebugViewSettings.drawThingsDynamic) { return; } drawingNow = true; try { bool[] fogGrid = map.fogGrid.fogGrid; CellRect currentViewRect = Find.CameraDriver.CurrentViewRect; currentViewRect.ClipInsideMap(map); currentViewRect = currentViewRect.ExpandedBy(1); CellIndices cellIndices = map.cellIndices; foreach (Thing drawThing in drawThings) { IntVec3 position = drawThing.Position; if ((currentViewRect.Contains(position) || drawThing.def.drawOffscreen) && (!fogGrid[cellIndices.CellToIndex(position)] || drawThing.def.seeThroughFog) && (!(drawThing.def.hideAtSnowDepth < 1f) || !(map.snowGrid.GetDepth(position) > drawThing.def.hideAtSnowDepth))) { try { drawThing.Draw(); } catch (Exception ex) { Log.Error(string.Concat("Exception drawing ", drawThing, ": ", ex.ToString())); } } } } catch (Exception arg) { Log.Error("Exception drawing dynamic things: " + arg); } drawingNow = false; }
public static bool AdjacentTo8WayOrInside(CellRect rect1, CellRect rect2) { return(!rect1.IsEmpty && !rect2.IsEmpty && rect1.ExpandedBy(1).Overlaps(rect2)); }