コード例 #1
0
        private static void Spawn_BlackLightningHit(ParticleOrchestraSettings settings)
        {
            float num         = Main.rand.NextFloat() * ((float)Math.PI * 2f);
            float num2        = 7f;
            float scaleFactor = 0.7f;
            int   num3        = 916;

            Main.instance.LoadProjectile(num3);
            Color value  = new Color(255, 255, 255, 255);
            Color indigo = Color.Indigo;

            indigo.A = 0;
            for (float num4 = 0f; num4 < 1f; num4 += 1f / num2)
            {
                float   num5         = (float)Math.PI * 2f * num4 + num + Main.rand.NextFloatDirection() * 0.25f;
                float   scaleFactor2 = Main.rand.NextFloat() * 4f + 0.1f;
                Vector2 vector       = Main.rand.NextVector2Circular(12f, 12f) * scaleFactor;
                Color.Lerp(Color.Lerp(Color.Black, indigo, Main.rand.NextFloat() * 0.5f), value, Main.rand.NextFloat() * 0.6f);
                Color colorTint = new Color(0, 0, 0, 255);
                int   num6      = Main.rand.Next(4);
                if (num6 == 1)
                {
                    colorTint = Color.Lerp(new Color(106, 90, 205, 127), Color.Black, 0.1f + 0.7f * Main.rand.NextFloat());
                }
                if (num6 == 2)
                {
                    colorTint = Color.Lerp(new Color(106, 90, 205, 60), Color.Black, 0.1f + 0.8f * Main.rand.NextFloat());
                }
                RandomizedFrameParticle randomizedFrameParticle = _poolRandomizedFrame.RequestParticle();
                randomizedFrameParticle.SetBasicInfo(TextureAssets.Projectile[num3], null, Vector2.Zero, vector);
                randomizedFrameParticle.SetTypeInfo(Main.projFrames[num3], 2, 24f);
                randomizedFrameParticle.Velocity              = num5.ToRotationVector2() * scaleFactor2 * new Vector2(1f, 0.5f);
                randomizedFrameParticle.ColorTint             = colorTint;
                randomizedFrameParticle.LocalPosition         = settings.PositionInWorld + vector;
                randomizedFrameParticle.Rotation              = num5;
                randomizedFrameParticle.Scale                 = Vector2.One;
                randomizedFrameParticle.FadeInNormalizedTime  = 0.01f;
                randomizedFrameParticle.FadeOutNormalizedTime = 0.5f;
                randomizedFrameParticle.ScaleVelocity         = new Vector2(0.05f);
                Main.ParticleSystem_World_OverPlayers.Add(randomizedFrameParticle);
            }
        }
コード例 #2
0
        private static void Spawn_BlackLightningHit(ParticleOrchestraSettings settings)
        {
            float num1 = Main.rand.NextFloat() * 6.283185f;
            float num2 = 7f;
            float num3 = 0.7f;
            int   i    = 916;

            Main.instance.LoadProjectile(i);
            Color color1 = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue);
            Color indigo = Color.Indigo;

            indigo.A = (byte)0;
            for (float num4 = 0.0f; (double)num4 < 1.0; num4 += 1f / num2)
            {
                float   f    = (float)(6.28318548202515 * (double)num4 + (double)num1 + (double)Main.rand.NextFloatDirection() * 0.25);
                float   num5 = (float)((double)Main.rand.NextFloat() * 4.0 + 0.100000001490116);
                Vector2 initialLocalPosition = Main.rand.NextVector2Circular(12f, 12f) * num3;
                Color.Lerp(Color.Lerp(Color.Black, indigo, Main.rand.NextFloat() * 0.5f), color1, Main.rand.NextFloat() * 0.6f);
                Color color2 = new Color(0, 0, 0, (int)byte.MaxValue);
                int   num6   = Main.rand.Next(4);
                if (num6 == 1)
                {
                    color2 = Color.Lerp(new Color(106, 90, 205, (int)sbyte.MaxValue), Color.Black, (float)(0.100000001490116 + 0.699999988079071 * (double)Main.rand.NextFloat()));
                }
                if (num6 == 2)
                {
                    color2 = Color.Lerp(new Color(106, 90, 205, 60), Color.Black, (float)(0.100000001490116 + 0.800000011920929 * (double)Main.rand.NextFloat()));
                }
                RandomizedFrameParticle randomizedFrameParticle = ParticleOrchestrator._poolRandomizedFrame.RequestParticle();
                randomizedFrameParticle.SetBasicInfo(TextureAssets.Projectile[i], new Rectangle?(), Vector2.Zero, initialLocalPosition);
                randomizedFrameParticle.SetTypeInfo(Main.projFrames[i], 2, 24f);
                randomizedFrameParticle.Velocity              = f.ToRotationVector2() * num5 * new Vector2(1f, 0.5f);
                randomizedFrameParticle.ColorTint             = color2;
                randomizedFrameParticle.LocalPosition         = settings.PositionInWorld + initialLocalPosition;
                randomizedFrameParticle.Rotation              = f;
                randomizedFrameParticle.Scale                 = Vector2.One;
                randomizedFrameParticle.FadeInNormalizedTime  = 0.01f;
                randomizedFrameParticle.FadeOutNormalizedTime = 0.5f;
                randomizedFrameParticle.ScaleVelocity         = new Vector2(0.05f);
                Main.ParticleSystem_World_OverPlayers.Add((IParticle)randomizedFrameParticle);
            }
        }