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

◆ Spawn_BlackLightningHit()

static void Terraria.GameContent.Drawing.ParticleOrchestrator.Spawn_BlackLightningHit ( ParticleOrchestraSettings settings)
inlinestaticprivate

Definition at line 1391 of file ParticleOrchestrator.cs.

1392 {
1393 float num = Main.rand.NextFloat() * ((float)Math.PI * 2f);
1394 float num2 = 7f;
1395 float num3 = 0.7f;
1396 int num4 = 916;
1397 Main.instance.LoadProjectile(num4);
1398 Color value = new Color(255, 255, 255, 255);
1399 Color indigo = Color.Indigo;
1400 indigo.A = 0;
1401 for (float num5 = 0f; num5 < 1f; num5 += 1f / num2)
1402 {
1403 float num6 = (float)Math.PI * 2f * num5 + num + Main.rand.NextFloatDirection() * 0.25f;
1404 float num7 = Main.rand.NextFloat() * 4f + 0.1f;
1405 Vector2 vector = Main.rand.NextVector2Circular(12f, 12f) * num3;
1406 Color.Lerp(Color.Lerp(Color.Black, indigo, Main.rand.NextFloat() * 0.5f), value, Main.rand.NextFloat() * 0.6f);
1407 Color colorTint = new Color(0, 0, 0, 255);
1408 int num8 = Main.rand.Next(4);
1409 if (num8 == 1)
1410 {
1411 colorTint = Color.Lerp(new Color(106, 90, 205, 127), Color.Black, 0.1f + 0.7f * Main.rand.NextFloat());
1412 }
1413 if (num8 == 2)
1414 {
1415 colorTint = Color.Lerp(new Color(106, 90, 205, 60), Color.Black, 0.1f + 0.8f * Main.rand.NextFloat());
1416 }
1417 RandomizedFrameParticle randomizedFrameParticle = _poolRandomizedFrame.RequestParticle();
1418 randomizedFrameParticle.SetBasicInfo(TextureAssets.Projectile[num4], null, Vector2.Zero, vector);
1419 randomizedFrameParticle.SetTypeInfo(Main.projFrames[num4], 2, 24f);
1420 randomizedFrameParticle.Velocity = num6.ToRotationVector2() * num7 * new Vector2(1f, 0.5f);
1421 randomizedFrameParticle.ColorTint = colorTint;
1422 randomizedFrameParticle.LocalPosition = settings.PositionInWorld + vector;
1423 randomizedFrameParticle.Rotation = num6;
1424 randomizedFrameParticle.Scale = Vector2.One;
1425 randomizedFrameParticle.FadeInNormalizedTime = 0.01f;
1426 randomizedFrameParticle.FadeOutNormalizedTime = 0.5f;
1427 randomizedFrameParticle.ScaleVelocity = new Vector2(0.05f);
1428 Main.ParticleSystem_World_OverPlayers.Add(randomizedFrameParticle);
1429 }
1430 }
const double PI
Definition Math.cs:16
static ParticlePool< RandomizedFrameParticle > _poolRandomizedFrame
virtual void SetBasicInfo(Asset< Texture2D > textureAsset, Rectangle? frame, Vector2 initialVelocity, Vector2 initialLocalPosition)
void SetTypeInfo(int animationFramesAmount, int gameFramesPerAnimationFrame, float timeToLive)
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References Terraria.GameContent.Drawing.ParticleOrchestrator._poolRandomizedFrame, Microsoft.Xna.Framework.Color.Black, Microsoft.Xna.Framework.Color.Indigo, Terraria.Main.instance, Microsoft.Xna.Framework.Color.Lerp(), Microsoft.Xna.Framework.Vector2.One, Terraria.Main.ParticleSystem_World_OverPlayers, System.Math.PI, Terraria.GameContent.TextureAssets.Projectile, Terraria.Main.projFrames, Terraria.Main.rand, Terraria.Graphics.Renderers.ABasicParticle.SetBasicInfo(), Terraria.Graphics.Renderers.RandomizedFrameParticle.SetTypeInfo(), System.value, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.GameContent.Drawing.ParticleOrchestrator.SpawnParticlesDirect().