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

◆ SpawnReturnPortalDust()

void Terraria.GameContent.PotionOfReturnGateHelper.SpawnReturnPortalDust ( )
inline

Definition at line 47 of file PotionOfReturnGateHelper.cs.

48 {
49 if (_gateType == GateType.EntryPoint)
50 {
51 if (Main.rand.Next(3) == 0)
52 {
53 if (Main.rand.Next(2) == 0)
54 {
55 Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
56 vector *= new Vector2(0.5f, 1f);
57 Dust dust = Dust.NewDustDirect(_position - vector * 30f, 0, 0, Utils.SelectRandom<int>(Main.rand, 86, 88));
58 dust.noGravity = true;
59 dust.noLightEmittence = true;
60 dust.position = _position - vector.SafeNormalize(Vector2.Zero) * Main.rand.Next(10, 21);
61 dust.velocity = vector.RotatedBy(1.5707963705062866) * 2f;
62 dust.scale = 0.5f + Main.rand.NextFloat();
63 dust.fadeIn = 0.5f;
64 dust.customData = this;
65 dust.position += dust.velocity * 10f;
66 dust.velocity *= -1f;
67 }
68 else
69 {
70 Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
71 vector2 *= new Vector2(0.5f, 1f);
72 Dust dust2 = Dust.NewDustDirect(_position - vector2 * 30f, 0, 0, 240);
73 dust2.noGravity = true;
74 dust2.noLight = true;
75 dust2.position = _position - vector2.SafeNormalize(Vector2.Zero) * Main.rand.Next(5, 10);
76 dust2.velocity = vector2.RotatedBy(-1.5707963705062866) * 3f;
77 dust2.scale = 0.5f + Main.rand.NextFloat();
78 dust2.fadeIn = 0.5f;
79 dust2.customData = this;
80 dust2.position += dust2.velocity * 10f;
81 dust2.velocity *= -1f;
82 }
83 }
84 }
85 else if (Main.rand.Next(3) == 0)
86 {
87 if (Main.rand.Next(2) == 0)
88 {
89 Vector2 vector3 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
90 vector3 *= new Vector2(0.5f, 1f);
91 Dust dust3 = Dust.NewDustDirect(_position - vector3 * 30f, 0, 0, Utils.SelectRandom<int>(Main.rand, 86, 88));
92 dust3.noGravity = true;
93 dust3.noLightEmittence = true;
94 dust3.position = _position;
95 dust3.velocity = vector3.RotatedBy(-0.7853981852531433) * 2f;
96 dust3.scale = 0.5f + Main.rand.NextFloat();
97 dust3.fadeIn = 0.5f;
98 dust3.customData = this;
99 dust3.position += vector3 * new Vector2(20f);
100 }
101 else
102 {
103 Vector2 vector4 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
104 vector4 *= new Vector2(0.5f, 1f);
105 Dust dust4 = Dust.NewDustDirect(_position - vector4 * 30f, 0, 0, Utils.SelectRandom<int>(Main.rand, 86, 88));
106 dust4.noGravity = true;
107 dust4.noLightEmittence = true;
108 dust4.position = _position;
109 dust4.velocity = vector4.RotatedBy(-0.7853981852531433) * 2f;
110 dust4.scale = 0.5f + Main.rand.NextFloat();
111 dust4.fadeIn = 0.5f;
112 dust4.customData = this;
113 dust4.position += vector4 * new Vector2(20f);
114 }
115 }
116 }

References Terraria.GameContent.PotionOfReturnGateHelper._gateType, Terraria.GameContent.PotionOfReturnGateHelper._position, Terraria.Dust.NewDustDirect(), Terraria.Main.rand, Microsoft.Xna.Framework.Vector2.UnitY, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.GameContent.PotionOfReturnGateHelper.Update().