public List <Point3D> GenerateSpawnLocations(Region r) { var locations = new List <Point3D>(); foreach (Rectangle3D area in r.Area) { int x = area.Start.X; int y = area.Start.Y; int z; while (y != area.End.Y) { while (x != area.End.X) { z = DungeonMap.GetAverageZ(x, y); if (DungeonMap.CanSpawnMobile(new Point3D(x, y, z))) { locations.Add(new Point3D(x, y, z)); } x++; } x = area.Start.X; y++; } } return(locations); }