private static void PlaceAt(DesertDescription description, Point position) { ShapeData shapeData = new ShapeData(); Point origin = new Point(position.X, position.Y + 2); WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(24, 12), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), new Actions.SetTile((ushort)53, false, true).Output(shapeData))); UnifiedRandom genRand = WorldGen.genRand; ShapeData data = new ShapeData(); int num1 = description.Hive.Top - position.Y; int direction = genRand.Next(2) == 0 ? -1 : 1; List <ChambersEntrance.PathConnection> pathConnectionList = new List <ChambersEntrance.PathConnection>() { new ChambersEntrance.PathConnection(new Point(position.X + -direction * 26, position.Y - 8), direction) }; int num2 = genRand.Next(2, 4); for (int index = 0; index < num2; ++index) { int y = (int)((double)(index + 1) / (double)num2 * (double)num1) + genRand.Next(-8, 9); int x = direction * genRand.Next(20, 41); int num3 = genRand.Next(18, 29); WorldUtils.Gen(position, (GenShape) new Shapes.Circle(num3 / 2, 3), Actions.Chain((GenAction) new Modifiers.Offset(x, y), (GenAction) new Modifiers.Blotches(2, 0.3), new Actions.Clear().Output(data), (GenAction) new Actions.PlaceWall((ushort)187, true))); pathConnectionList.Add(new ChambersEntrance.PathConnection(new Point(x + num3 / 2 * -direction + position.X, y + position.Y), -direction)); direction *= -1; } WorldUtils.Gen(position, (GenShape) new ModShapes.OuterOutline(data, true, false), Actions.Chain((GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)53 }), (GenAction) new Actions.SetTile((ushort)397, false, true), (GenAction) new Actions.PlaceWall((ushort)187, true))); GenShapeActionPair pair = new GenShapeActionPair((GenShape) new Shapes.Rectangle(2, 4), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Actions.Clear(), (GenAction) new Modifiers.Expand(1), (GenAction) new Actions.PlaceWall((ushort)187, true), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)53 }), (GenAction) new Actions.SetTile((ushort)397, false, true))); for (int index = 1; index < pathConnectionList.Count; ++index) { ChambersEntrance.PathConnection pathConnection1 = pathConnectionList[index - 1]; ChambersEntrance.PathConnection pathConnection2 = pathConnectionList[index]; float num3 = Math.Abs(pathConnection2.Position.X - pathConnection1.Position.X) * 1.5f; for (float amount = 0.0f; (double)amount <= 1.0; amount += 0.02f) { Vector2 vector2_1 = new Vector2(pathConnection1.Position.X + pathConnection1.Direction * num3 * amount, pathConnection1.Position.Y); Vector2 vector2_2 = new Vector2(pathConnection2.Position.X + (float)((double)pathConnection2.Direction * (double)num3 * (1.0 - (double)amount)), pathConnection2.Position.Y); Vector2 vector2_3 = Vector2.Lerp(pathConnection1.Position, pathConnection2.Position, amount); Vector2 vector2_4 = vector2_3; double num4 = (double)amount; WorldUtils.Gen(Vector2.Lerp(Vector2.Lerp(vector2_1, vector2_4, (float)num4), Vector2.Lerp(vector2_3, vector2_2, amount), amount).ToPoint(), pair); } } WorldUtils.Gen(origin, (GenShape) new Shapes.Rectangle(new Microsoft.Xna.Framework.Rectangle(-29, -12, 58, 12)), Actions.Chain((GenAction) new Modifiers.NotInShape(shapeData), (GenAction) new Modifiers.Expand(1), (GenAction) new Actions.PlaceWall((ushort)0, true))); }
private static void PlaceAt(DesertDescription description, Point position) { ShapeData shapeData = new ShapeData(); Point origin = new Point(position.X, position.Y + 2); WorldUtils.Gen(origin, new Shapes.Circle(24, 12), Actions.Chain(new Modifiers.Blotches(), new Actions.SetTile(53).Output(shapeData))); UnifiedRandom genRand = WorldGen.genRand; ShapeData data = new ShapeData(); int num = description.Hive.Top - position.Y; int num2 = (genRand.Next(2) != 0) ? 1 : (-1); List <PathConnection> list = new List <PathConnection> { new PathConnection(new Point(position.X + -num2 * 26, position.Y - 8), num2) }; int num3 = genRand.Next(2, 4); for (int i = 0; i < num3; i++) { int num4 = (int)((float)(i + 1) / (float)num3 * (float)num) + genRand.Next(-8, 9); int num5 = num2 * genRand.Next(20, 41); int num6 = genRand.Next(18, 29); WorldUtils.Gen(position, new Shapes.Circle(num6 / 2, 3), Actions.Chain(new Modifiers.Offset(num5, num4), new Modifiers.Blotches(), new Actions.Clear().Output(data), new Actions.PlaceWall(187))); list.Add(new PathConnection(new Point(num5 + num6 / 2 * -num2 + position.X, num4 + position.Y), -num2)); num2 *= -1; } WorldUtils.Gen(position, new ModShapes.OuterOutline(data), Actions.Chain(new Modifiers.Expand(1), new Modifiers.OnlyTiles(53), new Actions.SetTile(397), new Actions.PlaceWall(187))); GenShapeActionPair pair = new GenShapeActionPair(new Shapes.Rectangle(2, 4), Actions.Chain(new Modifiers.IsSolid(), new Modifiers.Blotches(), new Actions.Clear(), new Modifiers.Expand(1), new Actions.PlaceWall(187), new Modifiers.OnlyTiles(53), new Actions.SetTile(397))); for (int j = 1; j < list.Count; j++) { PathConnection pathConnection = list[j - 1]; PathConnection pathConnection2 = list[j]; float num7 = Math.Abs(pathConnection2.Position.X - pathConnection.Position.X) * 1.5f; for (float num8 = 0f; num8 <= 1f; num8 += 0.02f) { Vector2 value = new Vector2(pathConnection.Position.X + pathConnection.Direction * num7 * num8, pathConnection.Position.Y); Vector2 value2 = new Vector2(pathConnection2.Position.X + pathConnection2.Direction * num7 * (1f - num8), pathConnection2.Position.Y); Vector2 vector = Vector2.Lerp(pathConnection.Position, pathConnection2.Position, num8); Vector2 value3 = Vector2.Lerp(value, vector, num8); Vector2 value4 = Vector2.Lerp(vector, value2, num8); WorldUtils.Gen(Vector2.Lerp(value3, value4, num8).ToPoint(), pair); } } WorldUtils.Gen(origin, new Shapes.Rectangle(new Rectangle(-29, -12, 58, 12)), Actions.Chain(new Modifiers.NotInShape(shapeData), new Modifiers.Expand(1), new Actions.PlaceWall(0))); }
private static void PlaceAt(DesertDescription description, Point position, int holeRadius) { ShapeData data = new ShapeData(); WorldUtils.Gen(position, (GenShape) new Shapes.Rectangle(new Microsoft.Xna.Framework.Rectangle(-holeRadius, -holeRadius * 2, holeRadius * 2, holeRadius * 2)), new Actions.Clear().Output(data)); WorldUtils.Gen(position, (GenShape) new Shapes.Tail((float)(holeRadius * 2), new Vector2(0.0f, (float)holeRadius * 1.5f)), Actions.Chain(new Actions.Clear().Output(data))); WorldUtils.Gen(position, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Modifiers.Offset(0, 1), (GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Smooth(true))); GenShapeActionPair pair1 = new GenShapeActionPair((GenShape) new Shapes.Rectangle(1, 1), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Clear(), (GenAction) new Actions.PlaceWall((ushort)187, true))); GenShapeActionPair pair2 = new GenShapeActionPair((GenShape) new Shapes.Circle(2, 3), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort)397, false, true), (GenAction) new Actions.PlaceWall((ushort)187, true))); int x = position.X; int y1 = position.Y + (int)((double)holeRadius * 1.5); while (true) { int num1 = y1; Microsoft.Xna.Framework.Rectangle rectangle = description.Hive; int top1 = rectangle.Top; int y2 = position.Y; rectangle = description.Desert; int top2 = rectangle.Top; int num2 = (y2 - top2) * 2; int num3 = top1 + num2 + 12; if (num1 < num3) { WorldUtils.Gen(new Point(x, y1), pair1); WorldUtils.Gen(new Point(x, y1), pair2); if (y1 % 3 == 0) { x += WorldGen.genRand.Next(-1, 2); WorldUtils.Gen(new Point(x, y1), pair1); WorldUtils.Gen(new Point(x, y1), pair2); } ++y1; } else { break; } } WorldUtils.Gen(new Point(position.X, position.Y + 2), (GenShape) new ModShapes.All(data), (GenAction) new Actions.PlaceWall((ushort)0, true)); }
private static void PlaceAt(DesertDescription description, Point position, int holeRadius) { ShapeData data = new ShapeData(); WorldUtils.Gen(position, new Shapes.Rectangle(new Rectangle(-holeRadius, -holeRadius * 2, holeRadius * 2, holeRadius * 2)), new Actions.Clear().Output(data)); WorldUtils.Gen(position, new Shapes.Tail(holeRadius * 2, new Vector2(0f, (float)holeRadius * 1.5f)), Actions.Chain(new Actions.Clear().Output(data))); WorldUtils.Gen(position, new ModShapes.All(data), Actions.Chain(new Modifiers.Offset(0, 1), new Modifiers.Expand(1), new Modifiers.IsSolid(), new Actions.Smooth(applyToNeighbors: true))); GenShapeActionPair pair = new GenShapeActionPair(new Shapes.Rectangle(1, 1), Actions.Chain(new Modifiers.Blotches(), new Modifiers.IsSolid(), new Actions.Clear(), new Actions.PlaceWall(187))); GenShapeActionPair pair2 = new GenShapeActionPair(new Shapes.Circle(2, 3), Actions.Chain(new Modifiers.IsSolid(), new Actions.SetTile(397), new Actions.PlaceWall(187))); int num = position.X; for (int i = position.Y + (int)((float)holeRadius * 1.5f); i < description.Hive.Top + (position.Y - description.Desert.Top) * 2 + 12; i++) { WorldUtils.Gen(new Point(num, i), pair); WorldUtils.Gen(new Point(num, i), pair2); if (i % 3 == 0) { num += WorldGen.genRand.Next(-1, 2); WorldUtils.Gen(new Point(num, i), pair); WorldUtils.Gen(new Point(num, i), pair2); } } WorldUtils.Gen(new Point(position.X, position.Y + 2), new ModShapes.All(data), new Actions.PlaceWall(0)); }