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

◆ TreeGrowFX_AshShake()

static void Terraria.WorldGen.TreeGrowFX_AshShake ( int x,
int y,
int height,
bool hitTree = false )
inlinestaticprivate

Definition at line 21532 of file WorldGen.cs.

21533 {
21534 Vector2 vector = new Vector2(x, y) * 16f + new Vector2(8f, 8f);
21535 for (int num = 0; num > -height; num--)
21536 {
21537 if (num >= -height / 2 && Main.rand.Next(3) != 0)
21538 {
21539 int num2 = (hitTree ? 10 : 5);
21540 for (int i = 0; i < num2; i++)
21541 {
21542 Dust.NewDustDirect(vector + new Vector2(-16f, num * 16) + Utils.RandomVector2(Main.rand, -30f, 30f), 4, 4, 31, 0f, -3f, 100).velocity = Main.rand.NextVector2Circular(2f, 2f) + new Vector2(0f, -0.6f);
21543 }
21544 }
21545 if ((float)num >= (float)(-height) * 0.7f && Main.rand.Next(3) != 0)
21546 {
21547 int num3 = (hitTree ? 16 : 10);
21548 for (int j = 0; j < num3; j++)
21549 {
21550 Dust dust = Dust.NewDustDirect(vector + new Vector2(-16f, num * 16) + Utils.RandomVector2(Main.rand, -30f, 30f), 4, 4, 6, 0f, -4f, 0, default(Color), 1f + 0.7f * Main.rand.NextFloat());
21551 dust.velocity = Main.rand.NextVector2Circular(2f, 2f) + new Vector2(0f, -0.6f);
21552 if (Main.rand.Next(2) == 0)
21553 {
21554 dust.velocity *= 2f;
21555 dust.noGravity = true;
21556 }
21557 dust.velocity += new Vector2(0f, hitTree ? (-1f) : (-2f));
21558 }
21559 }
21560 if (!hitTree)
21561 {
21562 Gore.NewGoreDirect(vector + new Vector2(-16f, num * 16 - 40) + Utils.RandomVector2(Main.rand, -40f, 40f) * new Vector2(0.5f, 1f), Vector2.Zero, 61 + Main.rand.Next(3)).velocity *= 0.5f;
21563 }
21564 }
21565 }

References Terraria.Dust.NewDustDirect(), Terraria.Gore.NewGoreDirect(), Terraria.Main.rand, Terraria.Utils.RandomVector2(), and Microsoft.Xna.Framework.Vector2.Zero.