//////////////// /// <summary> /// Gets the identifiable region of a given point in the world. /// </summary> /// <param name="worldPos"></param> /// <returns></returns> public static WorldRegionFlags GetRegion(Vector2 worldPos) { WorldRegionFlags where = 0; if (WorldHelpers.IsSky(worldPos)) { where |= WorldRegionFlags.Sky; } else if (WorldHelpers.IsWithinUnderworld(worldPos)) { where |= WorldRegionFlags.Hell; } else if (WorldHelpers.IsAboveWorldSurface(worldPos)) { where |= WorldRegionFlags.Overworld; if (WorldHelpers.BeachEastTileX < (worldPos.Y / 16)) { where |= WorldRegionFlags.OceanEast; } else if (WorldHelpers.BeachWestTileX > (worldPos.Y / 16)) { where |= WorldRegionFlags.OceanWest; } } else { if (WorldHelpers.IsDirtLayer(worldPos)) { where |= WorldRegionFlags.CaveDirt; } else { if (WorldHelpers.IsPreRockLayer(worldPos)) { where |= WorldRegionFlags.CavePreRock; } if (WorldHelpers.IsRockLayer(worldPos)) { where |= WorldRegionFlags.CaveRock; if (WorldHelpers.IsLavaLayer(worldPos)) { where |= WorldRegionFlags.CaveLava; } } } } return(where); }