Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Perform()

override bool Terraria.GameContent.Generation.ShapeBranch.Perform ( Point origin,
GenAction action )
inline

Definition at line 46 of file ShapeBranch.cs.

47 {
48 //IL_012e: Unknown result type (might be due to invalid IL or missing references)
49 //IL_0163: Unknown result type (might be due to invalid IL or missing references)
50 //IL_0169: Unknown result type (might be due to invalid IL or missing references)
51 //IL_016b: Unknown result type (might be due to invalid IL or missing references)
52 //IL_0179: Unknown result type (might be due to invalid IL or missing references)
53 //IL_017e: Unknown result type (might be due to invalid IL or missing references)
54 //IL_0182: Unknown result type (might be due to invalid IL or missing references)
55 //IL_0192: Unknown result type (might be due to invalid IL or missing references)
56 Vector2D val = default(Vector2D);
57 ((Vector2D)(ref val))._002Ector((double)_offset.X, (double)_offset.Y);
58 double num = ((Vector2D)(ref val)).Length();
59 int num2 = (int)(num / 6.0);
60 if (_endPoints != null)
61 {
62 _endPoints.Add(new Point(origin.X + _offset.X, origin.Y + _offset.Y));
63 }
64 if (!PerformSegment(origin, action, origin, new Point(origin.X + _offset.X, origin.Y + _offset.Y), num2))
65 {
66 return false;
67 }
68 int num3 = (int)(num / 8.0);
69 Vector2D val2 = default(Vector2D);
70 for (int i = 0; i < num3; i++)
71 {
72 double num4 = ((double)i + 1.0) / ((double)num3 + 1.0);
73 Point point = new Point((int)(num4 * (double)_offset.X), (int)(num4 * (double)_offset.Y));
74 ((Vector2D)(ref val2))._002Ector((double)(_offset.X - point.X), (double)(_offset.Y - point.Y));
75 val2 = val2.RotatedBy((GenBase._random.NextDouble() * 0.5 + 1.0) * (double)((GenBase._random.Next(2) != 0) ? 1 : (-1))) * 0.75;
76 Point point2 = new Point((int)val2.X + point.X, (int)val2.Y + point.Y);
77 if (_endPoints != null)
78 {
79 _endPoints.Add(new Point(point2.X + origin.X, point2.Y + origin.Y));
80 }
81 if (!PerformSegment(origin, action, new Point(point.X + origin.X, point.Y + origin.Y), new Point(point2.X + origin.X, point2.Y + origin.Y), num2 - 1))
82 {
83 return false;
84 }
85 }
86 return true;
87 }
bool PerformSegment(Point origin, GenAction action, Point start, Point end, int size)
static UnifiedRandom _random
Definition GenBase.cs:9

References Terraria.GameContent.Generation.ShapeBranch._endPoints, Terraria.GameContent.Generation.ShapeBranch._offset, Terraria.WorldBuilding.GenBase._random, System.action, System.Collections.Generic.List< T >.Add(), Terraria.GameContent.Generation.ShapeBranch.PerformSegment(), Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.