public static DesertDescription CreateFromPlacement(Point origin) { Vector2 defaultBlockScale = DefaultBlockScale; float num = (float)Main.maxTilesX / 4200f; int num2 = (int)(80f * num); int num3 = (int)((WorldGen.genRand.NextFloat() + 1f) * 170f * num); int num4 = (int)(defaultBlockScale.X * (float)num2); int num5 = (int)(defaultBlockScale.Y * (float)num3); origin.X -= num4 / 2; SurfaceMap surfaceMap = SurfaceMap.FromArea(origin.X - 5, num4 + 10); if (RowHasInvalidTiles(origin.X, surfaceMap.Bottom, num4)) { return(Invalid); } int num6 = (int)(surfaceMap.Average + (float)surfaceMap.Bottom) / 2; origin.Y = num6 + WorldGen.genRand.Next(40, 60); return(new DesertDescription { CombinedArea = new Rectangle(origin.X, num6, num4, origin.Y + num5 - num6), Hive = new Rectangle(origin.X, origin.Y, num4, num5), Desert = new Rectangle(origin.X, num6, num4, origin.Y + num5 / 2 - num6), BlockScale = defaultBlockScale, BlockColumnCount = num2, BlockRowCount = num3, Surface = surfaceMap, IsValid = true }); }
public static DesertDescription CreateFromPlacement(Point origin) { Vector2 defaultBlockScale = DesertDescription.DefaultBlockScale; float num1 = (float)Main.maxTilesX / 4200f; int num2 = (int)(80.0 * (double)num1); int num3 = (int)(((double)WorldGen.genRand.NextFloat() + 1.0) * 170.0 * (double)num1); int width = (int)((double)defaultBlockScale.X * (double)num2); int height = (int)((double)defaultBlockScale.Y * (double)num3); origin.X -= width / 2; SurfaceMap surfaceMap = SurfaceMap.FromArea(origin.X - 5, width + 10); if (DesertDescription.RowHasInvalidTiles(origin.X, surfaceMap.Bottom, width)) { return(DesertDescription.Invalid); } int y = (int)((double)surfaceMap.Average + (double)surfaceMap.Bottom) / 2; origin.Y = y + WorldGen.genRand.Next(40, 60); return(new DesertDescription() { CombinedArea = new Rectangle(origin.X, y, width, origin.Y + height - y), Hive = new Rectangle(origin.X, origin.Y, width, height), Desert = new Rectangle(origin.X, y, width, origin.Y + height / 2 - y), BlockScale = defaultBlockScale, BlockColumnCount = num2, BlockRowCount = num3, Surface = surfaceMap, IsValid = true }); }
public void UpdateSurfaceMap() { Surface = SurfaceMap.FromArea(CombinedArea.Left - 5, CombinedArea.Width + 10); }
public void UpdateSurfaceMap() { this.Surface = SurfaceMap.FromArea(this.CombinedArea.Left - 5, this.CombinedArea.Width + 10); }