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

◆ DoRoot()

bool Terraria.GameContent.Generation.ShapeRoot.DoRoot ( Point origin,
GenAction action,
double angle,
double distance,
double startingSize )
inlineprivate

Definition at line 25 of file ShapeRoot.cs.

26 {
27 double num = origin.X;
28 double num2 = origin.Y;
29 for (double num3 = 0.0; num3 < distance * 0.85; num3 += 1.0)
30 {
31 double num4 = num3 / distance;
32 double num5 = Utils.Lerp(startingSize, _endingSize, num4);
33 num += Math.Cos(angle);
34 num2 += Math.Sin(angle);
35 angle += (double)GenBase._random.NextFloat() - 0.5 + (double)GenBase._random.NextFloat() * (_angle - 1.5707963705062866) * 0.1 * (1.0 - num4);
36 angle = angle * 0.4 + 0.45 * Utils.Clamp(angle, _angle - 2.0 * (1.0 - 0.5 * num4), _angle + 2.0 * (1.0 - 0.5 * num4)) + Utils.Lerp(_angle, 1.5707963705062866, num4) * 0.15;
37 for (int i = 0; i < (int)num5; i++)
38 {
39 for (int j = 0; j < (int)num5; j++)
40 {
41 if (!UnitApply(action, origin, (int)num + i, (int)num2 + j) && _quitOnFail)
42 {
43 return false;
44 }
45 }
46 }
47 }
48 return true;
49 }
static double Cos(double d)
static double Sin(double a)
static UnifiedRandom _random
Definition GenBase.cs:9
bool UnitApply(GenAction action, Point origin, int x, int y, params object[] args)
Definition GenShape.cs:13

References Terraria.GameContent.Generation.ShapeRoot._angle, Terraria.GameContent.Generation.ShapeRoot._endingSize, Terraria.WorldBuilding.GenShape._quitOnFail, Terraria.WorldBuilding.GenBase._random, System.action, System.Math.Cos(), Terraria.Utils.Lerp(), System.Math.Sin(), Terraria.WorldBuilding.GenShape.UnitApply(), Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.

Referenced by Terraria.GameContent.Generation.ShapeRoot.Perform().