// This determines which sector the thing is in and links it public void DetermineSector(VisualBlockMap blockmap) { // Find nearest sectors using the blockmap List <Sector> possiblesectors = blockmap.GetBlock(blockmap.GetBlockCoordinates(pos)).Sectors; // Check in which sector we are sector = null; foreach (Sector s in possiblesectors) { if (s.Intersect(pos)) { sector = s; break; } } }
// This determines which sector the thing is in and links it public void DetermineSector(VisualBlockMap blockmap) { //mxd. First check if the sprite is still in the same sector if (sector != null && !sector.IsDisposed && sector.Intersect(pos)) { return; } // Find nearest sectors using the blockmap List <Sector> possiblesectors = blockmap.GetBlock(blockmap.GetBlockCoordinates(pos)).Sectors; // Check in which sector we are sector = null; foreach (Sector s in possiblesectors) { if (s.Intersect(pos)) { sector = s; break; } } }