private void updateViewBlockerCells(bool blockView)
        {
#if InternalProfile
            ProfilingUtils.startProfiling("CompViewBlockerWatcher.updateViewBlockerCells");
#endif
            bool[] viewBlockerCells = mapCompSeenFog.viewBlockerCells;

            int mapSizeZ = map.Size.z;
            int mapSizeX = map.Size.x;

            CellRect occupiedRect = parent.OccupiedRect();
            for (int x = occupiedRect.minX; x <= occupiedRect.maxX; x++)
            {
                for (int z = occupiedRect.minZ; z <= occupiedRect.maxZ; z++)
                {
                    if (x >= 0 && z >= 0 && x <= mapSizeX && z <= mapSizeZ)
                    {
                        viewBlockerCells[(z * mapSizeZ) + x] = blockView;
                    }
                }
            }

            IntVec3 thisPos = parent.Position;
            if (Current.ProgramState == ProgramState.Playing)
            {
                if (map != null)
                {
                    List <CompFieldOfViewWatcher> cmpFovs = mapCompSeenFog.fowWatchers;
                    for (int i = 0; i < cmpFovs.Count; i++)
                    {
                        CompFieldOfViewWatcher cmpFov = cmpFovs[i];
                        int thingSightRange           = cmpFov.lastSightRange;

                        if (thingSightRange > 0)
                        {
                            IntVec3 thingPos = cmpFov.parent.Position;

                            int x = thisPos.x - thingPos.x;
                            int z = thisPos.z - thingPos.z;

                            if (x * x + z * z < thingSightRange * thingSightRange)
                            {
                                cmpFov.refreshFovTarget(ref thisPos);
                            }
                        }
                    }
                }
            }

#if InternalProfile
            ProfilingUtils.stopProfiling("CompViewBlockerWatcher.updateViewBlockerCells");
#endif
        }
        private void updateViewBlockerCells(bool blockView)
        {
            bool[] viewBlockerCells = mapCompSeenFog.viewBlockerCells;

            int mapSizeZ = map.Size.z;
            int mapSizeX = map.Size.x;

            CellRect occupiedRect = parent.OccupiedRect();

            for (int x = occupiedRect.minX; x <= occupiedRect.maxX; x++)
            {
                for (int z = occupiedRect.minZ; z <= occupiedRect.maxZ; z++)
                {
                    if (x >= 0 && z >= 0 && x <= mapSizeX && z <= mapSizeZ)
                    {
                        viewBlockerCells[(z * mapSizeZ) + x] = blockView;
                    }
                }
            }

            if (Current.ProgramState == ProgramState.Playing)
            {
                if (map != null)
                {
                    List <Thing> things = map.listerThings.AllThings;
                    for (int i = 0; i < things.Count; i++)
                    {
                        ThingWithComps thing = things[i] as ThingWithComps;
                        if (thing != null)
                        {
                            CompMainComponent compMain = (CompMainComponent)thing.TryGetComp(CompMainComponent.COMP_DEF);
                            if (compMain != null)
                            {
                                CompFieldOfViewWatcher cmpFov = compMain.compFieldOfViewWatcher;
                                if (cmpFov != null && parent.Position.InHorDistOf(thing.Position, cmpFov.sightRange))
                                {
                                    cmpFov.updateFoV(true);
                                }
                            }
                        }
                    }
                }
            }
        }