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

◆ TeleportEffect()

static void Terraria.Main.TeleportEffect ( Microsoft::Xna::Framework::Rectangle effectRect,
int Style,
int extraInfo = 0,
float dustCountMult = 1f,
TeleportationSide side = TeleportationSide::Entry,
Vector2 otherPosition = default(Vector2) )
inlinestatic

Definition at line 12270 of file Main.cs.

12271 {
12272 switch (Style)
12273 {
12274 case 0:
12275 {
12277 int num2 = effectRect.Width * effectRect.Height / 5;
12278 num2 = (int)((float)num2 * dustCountMult);
12279 for (int j = 0; j < num2; j++)
12280 {
12281 int num3 = Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 159);
12282 Main.dust[num3].scale = (float)rand.Next(20, 70) * 0.01f;
12283 if (j < 10)
12284 {
12285 Main.dust[num3].scale += 0.25f;
12286 }
12287 if (j < 5)
12288 {
12289 Main.dust[num3].scale += 0.25f;
12290 }
12291 }
12292 break;
12293 }
12294 case 1:
12295 {
12297 int num10 = effectRect.Width * effectRect.Height / 5;
12298 num10 = (int)((float)num10 * dustCountMult);
12299 for (int num11 = 0; num11 < num10; num11++)
12300 {
12301 int num12 = Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 164);
12302 Main.dust[num12].scale = (float)rand.Next(20, 70) * 0.01f;
12303 if (num11 < 10)
12304 {
12305 Main.dust[num12].scale += 0.25f;
12306 }
12307 if (num11 < 5)
12308 {
12309 Main.dust[num12].scale += 0.25f;
12310 }
12311 }
12312 break;
12313 }
12314 case 2:
12315 {
12316 int num15 = (int)(50f * dustCountMult);
12317 for (int num16 = 0; num16 < num15; num16++)
12318 {
12319 Main.dust[Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 58, 0f, 0f, 150, Microsoft.Xna.Framework.Color.GhostWhite, 1.2f)].velocity *= 0.5f;
12320 }
12321 break;
12322 }
12323 case 3:
12324 {
12326 int num5 = (int)(50f * dustCountMult);
12327 for (int l = 0; l < num5; l++)
12328 {
12329 int num6 = Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 180);
12330 Main.dust[num6].noGravity = true;
12331 for (int m = 0; m < 5; m++)
12332 {
12333 if (rand.Next(3) == 0)
12334 {
12335 Main.dust[num6].velocity *= 0.75f;
12336 }
12337 }
12338 if (rand.Next(3) == 0)
12339 {
12340 Main.dust[num6].velocity *= 2f;
12341 Main.dust[num6].scale *= 1.2f;
12342 }
12343 if (rand.Next(3) == 0)
12344 {
12345 Main.dust[num6].velocity *= 2f;
12346 Main.dust[num6].scale *= 1.2f;
12347 }
12348 if (rand.Next(2) == 0)
12349 {
12350 Main.dust[num6].fadeIn = (float)rand.Next(75, 100) * 0.01f;
12351 Main.dust[num6].scale = (float)rand.Next(25, 75) * 0.01f;
12352 }
12353 Main.dust[num6].scale *= 0.8f;
12354 }
12355 break;
12356 }
12357 case 4:
12358 {
12360 int num17 = effectRect.Width * effectRect.Height / 5;
12361 num17 = (int)((float)num17 * dustCountMult);
12362 for (int num18 = 0; num18 < num17; num18++)
12363 {
12364 Dust obj4 = Main.dust[Dust.NewDust(effectRect.TopLeft(), effectRect.Width, effectRect.Height, 263)];
12366 obj4.noLight = true;
12367 obj4.noGravity = true;
12368 obj4.scale = 1.2f;
12369 obj4.fadeIn = 0.4f;
12370 obj4.color.A = byte.MaxValue;
12371 }
12372 break;
12373 }
12374 case 5:
12375 {
12376 Vector2 position = effectRect.TopLeft();
12377 int num8 = (int)(100f * dustCountMult);
12378 for (int num9 = 0; num9 < num8; num9++)
12379 {
12380 Dust obj3 = Dust.NewDustDirect(position, effectRect.Width, effectRect.Height + 24, Dust.dustWater());
12381 obj3.velocity.Y *= 0f;
12382 obj3.velocity.Y -= 3.5f;
12383 obj3.velocity.X *= 1.5f;
12384 obj3.scale = 0.8f;
12385 obj3.alpha = 130;
12386 obj3.noGravity = true;
12387 obj3.fadeIn = 1.2f;
12388 }
12389 SoundEngine.PlaySound(19, effectRect.Center.ToVector2(), 0);
12390 break;
12391 }
12392 case 7:
12393 {
12394 Vector2 position2 = effectRect.TopLeft();
12395 int num19 = (int)(50f * dustCountMult);
12396 for (int num20 = 0; num20 < num19; num20++)
12397 {
12398 Dust obj5 = Dust.NewDustDirect(position2, effectRect.Width, effectRect.Height + 24, 35);
12399 obj5.velocity.Y *= 0f;
12400 obj5.velocity.Y -= 3.5f;
12401 obj5.velocity.X *= 1.5f;
12402 obj5.scale = 0.8f;
12403 obj5.alpha = 130;
12404 obj5.noGravity = true;
12405 obj5.fadeIn = 1.2f;
12406 }
12407 SoundEngine.PlaySound(SoundID.Item8, effectRect.Center.ToVector2());
12408 break;
12409 }
12410 case 9:
12411 {
12412 effectRect.Inflate(15, 15);
12413 int num13 = (int)(100f * dustCountMult);
12414 for (int num14 = 0; num14 < num13; num14++)
12415 {
12417 }
12419 break;
12420 }
12421 case 10:
12422 {
12423 effectRect.Inflate(15, 15);
12424 int num7 = (int)(60f * dustCountMult);
12425 Vector2 vector = otherPosition - effectRect.TopLeft();
12426 for (int n = 0; n < num7; n++)
12427 {
12428 float fadeIn = 0.4f + rand.NextFloat();
12429 float scale = 0.4f + rand.NextFloat();
12430 Microsoft.Xna.Framework.Color newColor = hslToRgb(0.66f + rand.NextFloat() * 0.24f, 1f, 0.5f);
12431 Dust dust = Dust.NewDustDirect(effectRect.TopLeft(), effectRect.Width, effectRect.Height, 267, 0f, 0f, 127, newColor);
12432 dust.scale = (float)rand.Next(20, 70) * 0.01f;
12433 if (n < 10)
12434 {
12435 dust.scale += 0.25f;
12436 }
12437 if (n < 5)
12438 {
12439 dust.scale += 0.25f;
12440 }
12441 if ((float)n < (float)num7 * 0.8f)
12442 {
12443 dust.velocity += vector * 0.1f * rand.NextFloat();
12444 }
12445 dust.noGravity = true;
12446 dust.noLight = true;
12447 dust.scale = scale;
12448 dust.fadeIn = fadeIn;
12449 if (dust.dustIndex != 6000)
12450 {
12451 Dust obj2 = Dust.CloneDust(dust);
12452 obj2.scale *= 0.65f;
12453 obj2.fadeIn *= 0.65f;
12454 obj2.color = new Microsoft.Xna.Framework.Color(255, 255, 255, 255);
12455 }
12456 }
12458 break;
12459 }
12460 case 11:
12461 {
12462 for (int k = 0; k < 50; k++)
12463 {
12464 int num4 = rand.Next(4);
12466 switch (num4)
12467 {
12468 case 0:
12469 case 1:
12470 color = new Microsoft.Xna.Framework.Color(100, 255, 100);
12471 break;
12472 case 2:
12474 break;
12475 case 3:
12477 break;
12478 }
12479 Dust obj = Dust.NewDustPerfect(rand.NextVector2FromRectangle(effectRect), 267);
12480 obj.noGravity = true;
12481 obj.color = color;
12482 obj.velocity *= 2f;
12483 obj.scale = 0.8f + rand.NextFloat() * 0.6f;
12484 obj.fadeIn = 0.5f;
12485 }
12486 break;
12487 }
12488 case 13:
12489 {
12490 SoundEngine.PlaySound(SoundID.Item8, effectRect.Center.ToVector2());
12491 for (int i = 0; i < 21; i++)
12492 {
12493 int num = Dust.NewDust(rand.NextVector2FromRectangle(effectRect), 2, 2, 27, 0f, 0f, 100, default(Microsoft.Xna.Framework.Color), rand.Next(1, 3));
12494 Main.dust[num].velocity *= 1.75f;
12495 if (i % 3 == 0)
12496 {
12497 Main.dust[num].velocity *= 1.5f;
12498 }
12499 Main.dust[num].noLightEmittence = true;
12500 Main.dust[num].noGravity = true;
12501 }
12502 break;
12503 }
12504 }
12505 }
static void PlaySound(int type, Vector2 position, int style=1)
static Color GetPortalColor(int colorIndex)
static void SpawnInWorldDust(int tileStyle, Rectangle dustBox)
static readonly LegacySoundStyle Item6
Definition SoundID.cs:426
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static UnifiedRandom rand
Definition Main.cs:1387
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static Dust[] dust
Definition Main.cs:1677

References Terraria.Dust.CloneDust(), Terraria.Main.dust, Terraria.Dust.dustWater(), Terraria.GameContent.PortalHelper.GetPortalColor(), Microsoft.Xna.Framework.Color.GhostWhite, Microsoft.Xna.Framework.Color.Green, Terraria.Main.hslToRgb(), System.Text.RegularExpressions.i, Terraria.ID.SoundID.Item6, Terraria.ID.SoundID.Item8, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Dust.NewDustPerfect(), System.obj, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.GameContent.TeleportPylonsSystem.SpawnInWorldDust(), Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, and Microsoft.Xna.Framework.Color.Yellow.

Referenced by Terraria.NPC.Teleport(), and Terraria.Player.Teleport().