Ejemplo n.º 1
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix);
            DrawUtils.AnotherDraw(BlendState.NonPremultiplied);
            Texture2D tex1 = mod.GetTexture("Projectiles/EyeBullet1");
            Texture2D tex2 = mod.GetTexture("Projectiles/EyeBullet2");
            Texture2D tex3 = mod.GetTexture("Projectiles/EyeBullet3");
            float     ops1, ops2;
            bool      IsScale = false;

            if (projectile.ai[0] < 0)
            {
                IsScale = true;
                ops1    = 0;
                ops2    = 0;
            }
            else if (projectile.ai[0] < 30)
            {
                IsScale = true;
                ops1    = projectile.ai[0] / 30;
                ops2    = 0;
            }
            else
            {
                ops1 = (60 - projectile.ai[0]) / 30;
                ops2 = (projectile.ai[0] - 30) / 30;
            }
            if (IsScale)
            {
                spriteBatch.Draw(tex1, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex1.Size() / 2, projectile.scale * 0.3f * (ExtraAlpha / 30f), SpriteEffects.None, 0);
            }
            else
            {
                spriteBatch.Draw(tex1, projectile.Center - Main.screenPosition, null, Color.White * ops1, projectile.rotation, tex1.Size() / 2, projectile.scale * 0.3f, SpriteEffects.None, 0);
            }
            spriteBatch.Draw(tex2, projectile.Center - Main.screenPosition, null, Color.White * ops2, projectile.rotation, tex2.Size() / 2, projectile.scale * 0.3f, SpriteEffects.None, 0);
            DrawUtils.AnotherDraw(BlendState.Additive);
            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix);
            spriteBatch.Draw(tex3, projectile.Center - Main.screenPosition, null, Color.White * ops2 * 0.6f, 0, tex3.Size() / 2, projectile.scale * 0.45f, SpriteEffects.None, 0);

            DrawUtils.AnotherDraw(BlendState.AlphaBlend);
            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix);
            return(false);
        }
Ejemplo n.º 2
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D tex1 = mod.GetTexture("Projectiles/Justice1");
            Texture2D tex2 = mod.GetTexture("Projectiles/Justice2");
            Texture2D tex3 = mod.GetTexture("Projectiles/Justice3");

            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix);
            DrawUtils.AnotherDraw(BlendState.NonPremultiplied);
            spriteBatch.Draw(tex1, projectile.Center - Main.screenPosition, null, Color.White * projectile.Opacity, projectile.rotation, tex1.Size() / 2, projectile.scale * 3f, SpriteEffects.None, 0);
            Vector2 DrawPos = projectile.Center + projectile.rotation.ToRotationVector2() * ArmLength * projectile.scale - Main.screenPosition;

            spriteBatch.Draw(tex2, DrawPos, null, Color.White * projectile.Opacity, ArmRot, new Vector2(tex2.Width / 2, 0), projectile.scale * 3f, SpriteEffects.None, 0);

            DrawPos = projectile.Center - projectile.rotation.ToRotationVector2() * ArmLength * projectile.scale - Main.screenPosition;
            spriteBatch.Draw(tex2, DrawPos, null, Color.White * projectile.Opacity, -ArmRot, new Vector2(tex2.Width / 2, 0), projectile.scale * 3f, SpriteEffects.None, 0);

            spriteBatch.Draw(tex3, projectile.Center + new Vector2(0, -10) - Main.screenPosition, null, Color.White * projectile.Opacity, 0, tex3.Size() / 2, projectile.scale / 2, SpriteEffects.None, 0);
            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix);
            DrawUtils.AnotherDraw(BlendState.AlphaBlend);
            return(false);
        }
Ejemplo n.º 3
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D TrailTex = mod.GetTexture("Projectiles/EyeBulletTrail");
            Texture2D tex2     = mod.GetTexture("Projectiles/EyeBullet2");
            Texture2D tex3     = mod.GetTexture("Projectiles/EyeBullet3");

            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix);
            DrawUtils.AnotherDraw(BlendState.Additive);
            for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[projectile.type] - 1; i++)
            {
                //int i2 = (int)(i + projectile.ai[0]) % (ProjectileID.Sets.TrailCacheLength[projectile.type] - 1);
                Rectangle rectangle = new Rectangle(0, 5 * i, 84, 5 * (i + 1));  //10 84
                float     len       = (projectile.oldPos[i + 1] - projectile.oldPos[i]).Length();
                if (projectile.oldPos[i + 1] == Vector2.Zero || projectile.oldPos[i] == Vector2.Zero)
                {
                    continue;
                }
                Vector2 scale     = new Vector2(0.2f, len / 10);
                float   ops       = (50f - i) / 50f;
                Vector2 MidCenter = (projectile.oldPos[i] + projectile.oldPos[i + 1]) / 2 + projectile.Size / 2;
                spriteBatch.Draw(TrailTex, MidCenter - Main.screenPosition, rectangle, Color.Orange * ops, projectile.oldRot[i], rectangle.Size() / 2, scale, SpriteEffects.None, 0);
            }

            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix);
            DrawUtils.AnotherDraw(BlendState.NonPremultiplied);
            spriteBatch.Draw(tex2, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex2.Size() / 2, projectile.scale * 0.3f, SpriteEffects.None, 0);
            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix);
            DrawUtils.AnotherDraw(BlendState.Additive);
            spriteBatch.Draw(tex3, projectile.Center - Main.screenPosition, null, Color.White * 0.75f, 0, tex3.Size() / 2, projectile.scale * 0.45f, SpriteEffects.None, 0);

            if (projectile.ai[0] < 30)
            {
                if (Twilight.FindBody() != -1)
                {
                    Vector2 Pos       = new Vector2(projectile.localAI[0], projectile.localAI[1]);
                    Vector2 ScreenPos = Pos + Main.npc[Twilight.FindBody()].Center - Main.screenPosition;
                    float   R         = projectile.ai[0] * 6f;
                    float   ops       = 1;
                    if (projectile.ai[0] >= 15)
                    {
                        ops = (30 - projectile.ai[0]) / 15;
                    }
                    //Main.spriteBatch.End();
                    //Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix);
                    DrawUtils.AnotherDraw(SpriteSortMode.Immediate);
                    DrawData data = new DrawData(TextureManager.Load("Images/Misc/Perlin"), ScreenPos, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, (int)(R * 2), (int)(R * 2))), Color.Orange * ops, projectile.rotation, new Vector2(R, R), new Vector2(1, 0.67f), SpriteEffects.None, 0);
                    GameShaders.Misc["ForceField"].UseColor(new Vector3(2f));
                    GameShaders.Misc["ForceField"].Apply(new DrawData?(data));
                    data.Draw(spriteBatch);
                    DrawUtils.AnotherDraw(SpriteSortMode.Deferred);
                    //Main.spriteBatch.End();
                    //Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix);
                }
            }
            DrawUtils.AnotherDraw(BlendState.AlphaBlend);
            //spriteBatch.End();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix);
            return(false);
        }