コード例 #1
0
 public ControllableCharacter(T2 tex, V2 pos, REC?rec, Color color,
                              F rot, V2 org, V2 scale, SE flip, F layer, Keys l = Keys.Left, Keys r = Keys.Right, Keys u = Keys.Up, Keys d = Keys.Down, float v = 20)
     : base(tex, pos, rec, color, rot, org, scale, flip, layer)
 {
     this.l = l;
     this.r = r;
     this.u = u;
     this.d = d;
     this.v = v;
 }
コード例 #2
0
        public void DrawLava()
        {
            bool facingleft = projectile.velocity.X > 0;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = SGAmod.ExtraTextures[104 + (int)projectile.ai[0]];
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), Color.White * trans, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, facingleft ? effect : SpriteEffects.None, 0);
        }
コード例 #3
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            bool facingleft = projectile.velocity.X > 0;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = Main.projectileTexture[projectile.type];
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, facingleft ? effect : SpriteEffects.None, 0);
            return(false);
        }
コード例 #4
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            //HairShaderData shader = GameShaders.Hair.GetShaderFromItemId(ItemID.LeinforsAccessory);
            bool facingleft = projectile.velocity.X > 0;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = Main.itemTexture[ItemID.GlassBowl];
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor * trans, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, facingleft ? effect : SpriteEffects.None, 0);
            return(false);
        }
コード例 #5
0
 public Drawit(T2 tex, V2 pos, REC?rec, Color color,
               F rot, V2 org, V2 scale, SE flip, F layer)
 {
     this.tex   = tex;
     this.pos   = pos;
     this.rec   = rec;
     this.color = color;
     this.rot   = rot;
     this.org   = org;
     this.scale = scale;
     this.flip  = flip;
     this.layer = layer;
 }
コード例 #6
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            bool facingleft = projectile.Center.X < Main.player[projectile.owner].Center.X;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = Main.projectileTexture[projectile.type];
            Texture2D glow    = mod.GetTexture("Items/GlowMasks/ThermalPike_Glow");
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, facingleft ? effect : SpriteEffects.None, 0);
            Main.spriteBatch.Draw(glow, projectile.Center - Main.screenPosition, new Rectangle?(), Color.White, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, facingleft ? effect : SpriteEffects.None, 0);
            return(false);
        }
コード例 #7
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            bool facingleft = projectile.velocity.X > 0;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = Main.projectileTexture[projectile.type];
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);
            Vector2   scaler  = new Vector2(Main.rand.NextFloat(0.75f, 1.25f), Main.rand.NextFloat(0.75f, 1.25f) * 0.5f + (projectile.velocity.Length() / 10f));

            Main.spriteBatch.Draw(ModContent.GetTexture("SGAmod/HavocGear/Projectiles/HeatWave"), projectile.Center - Main.screenPosition, new Rectangle?(), Color.White * MathHelper.Clamp((projectile.velocity.Length() - 6f) / 4f, 0f, 1f), projectile.velocity.ToRotation() + MathHelper.ToRadians(90),
                                  new Vector2(ModContent.GetTexture("SGAmod/HavocGear/Projectiles/HeatWave").Width * 0.5f, ModContent.GetTexture("SGAmod/HavocGear/Projectiles/HeatWave").Height * 0.5f), scaler, SpriteEffects.None, 0);
            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor, projectile.rotation, origin, projectile.scale, facingleft ? effect : SpriteEffects.None, 0);

            return(false);
        }
コード例 #8
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            Player owner      = Main.player[projectile.owner];
            bool   facingleft = projectile.direction < 0f;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally;
            Texture2D texture = ModContent.GetTexture(JavelinProj.tex[(int)projectile.ai[1]] + "Spear");
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);
            Vector2   drawpos = projectile.Center;

            if (projectile.ai[1] == (int)JavelinType.CrimsonCatastrophe)
            {
                drawpos   += Vector2.Normalize(projectile.Center - owner.Center) * 64f;
                drawColor *= 0.5f;// MathHelper.Clamp((float)(projectile.timeLeft-60f) / 25f,0, 1f);

                for (float i = 0; i < 1f && projectile.ai[1] == 10; i += 0.02f)
                {
                    Vector2 offset = (owner.Center - projectile.Center) * i;
                    drawColor *= (1f - (i / 8f));

                    if (facingleft)
                    {
                        Main.spriteBatch.Draw(texture, (drawpos + offset) - Main.screenPosition, new Rectangle?(), drawColor, ((projectile.rotation - (float)Math.PI / 2) - (float)Math.PI / 2) + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, effect, 0);
                    }
                    if (!facingleft)
                    {
                        Main.spriteBatch.Draw(texture, (drawpos + offset) - Main.screenPosition, new Rectangle?(), drawColor, (projectile.rotation - (float)Math.PI / 2) + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, SpriteEffects.None, 0);
                    }
                }
            }
            else
            {
                if (facingleft)
                {
                    Main.spriteBatch.Draw(texture, (drawpos) - Main.screenPosition, new Rectangle?(), drawColor, ((projectile.rotation - (float)Math.PI / 2) - (float)Math.PI / 2) + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, effect, 0);
                }
                if (!facingleft)
                {
                    Main.spriteBatch.Draw(texture, (drawpos) - Main.screenPosition, new Rectangle?(), drawColor, (projectile.rotation - (float)Math.PI / 2) + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, SpriteEffects.None, 0);
                }
            }



            return(false);
        }
コード例 #9
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            bool facingleft = projectile.direction < 0f;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally;
            Texture2D texture = Main.projectileTexture[projectile.type];
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            if (facingleft)
            {
                Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor, ((projectile.rotation - (float)Math.PI / 2) - (float)Math.PI / 2) + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, effect, 0);
            }
            if (!facingleft)
            {
                Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor, (projectile.rotation - (float)Math.PI / 2) + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, SpriteEffects.None, 0);
            }

            return(false);
        }
コード例 #10
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            Main.spriteBatch.End();
            Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);
            ArmorShaderData shader = GameShaders.Armor.GetShaderFromItemId(ItemID.SolarDye);

            //HairShaderData shader = GameShaders.Hair.GetShaderFromItemId(ItemID.LeinforsAccessory);
            shader.Apply(null);
            bool facingleft = projectile.velocity.X > 0;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = ModContent.GetTexture("Terraria/Projectile_" + (424 + projectile.ai[0]));
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor * trans, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f), origin, projectile.scale, facingleft ? effect : SpriteEffects.None, 0);
            Main.spriteBatch.End();
            Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.ZoomMatrix);
            return(false);
        }
コード例 #11
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            bool facingleft = projectile.velocity.X > 0;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = ModContent.GetTexture(JavelinProj.tex[(int)projectile.ai[1]]);
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);

            if (projectile.ai[1] == 8 && stickin < 0)
            {
                for (int k = 0; k < projectile.oldPos.Length; k++)
                {
                    Vector2 drawPos = new Vector2(projectile.oldPos[k].X + projectile.width / 2, projectile.oldPos[k].Y + projectile.height / 2) - Main.screenPosition;
                    Color   color   = projectile.GetAlpha(drawColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length);
                    spriteBatch.Draw(texture, drawPos, new Rectangle?(), color * 0.5f, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f) - (((float)Math.PI / 2) * (facingleft ? 0f : -1f)), origin, projectile.scale, facingleft ? effect : SpriteEffects.FlipHorizontally, 0);
                }
            }


            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f) - (((float)Math.PI / 2) * (facingleft ? 0f : -1f)), origin, projectile.scale, facingleft ? effect : SpriteEffects.FlipHorizontally, 0);
            return(false);
        }
コード例 #12
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
        {
            bool facingleft = projectile.velocity.X > 0;

            Microsoft.Xna.Framework.Graphics.SpriteEffects effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
            Texture2D texture = ModContent.GetTexture(JavelinProj.tex[(int)projectile.ai[1]]);
            Vector2   origin  = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);


            if (projectile.ai[1] == (int)JavelinType.CrimsonCatastrophe)
            {
                if (stickin >= 0)
                {
                    drawColor = Color.Lerp(drawColor, Color.Red, 0.50f + (float)Math.Sin(projectile.timeLeft / 15f) / 3f);
                }

                float sticktime = (float)maxStickTime;
                float alpha     = 1;
                if (projectile.penetrate <= 1)
                {
                    alpha *= MathHelper.Clamp((float)(projectile.timeLeft - 100) / 10f, 0f, 1f);
                }

                drawColor *= alpha;

                if (stickin >= 0)
                {
                    for (float k = 0; k < MathHelper.TwoPi; k += MathHelper.Pi / 2f)
                    {
                        float   angle   = (k + (float)projectile.whoAmI + Main.GlobalTime);
                        Vector2 drawPos = projectile.Center + Vector2.Normalize(angle.ToRotationVector2()) * 260;
                        Color   color   = drawColor * MathHelper.Clamp(projectile.localAI[0] / 10f, 0.25f, 1f);

                        spriteBatch.Draw(texture, drawPos - Main.screenPosition, new Rectangle?(), color * 0.5f, angle - (3f * MathHelper.Pi / 4f), origin, projectile.scale, effect, 0);

                        angle = (k - (float)projectile.whoAmI - Main.GlobalTime);
                        float timedelay   = (float)(projectile.timeLeft - 100) / sticktime;
                        float alpha2      = MathHelper.Clamp((float)Math.Sin((double)timedelay * Math.PI) * 2f, 0f, 1f);
                        float distancemul = 100f / sticktime;
                        drawPos = projectile.Center + Vector2.Normalize(angle.ToRotationVector2()) * (projectile.timeLeft - 100) * (8f * distancemul);
                        color   = drawColor * alpha2;

                        spriteBatch.Draw(texture, drawPos - Main.screenPosition, new Rectangle?(), color * 0.5f, MathHelper.Pi + angle - (3f * MathHelper.Pi / 4f), origin, projectile.scale, effect, 0);
                    }
                    return(false);
                }

                for (int k = 0; k < projectile.oldPos.Length; k++)
                {
                    drawColor = Color.Lerp(drawColor, Color.Red, 0.50f + (float)Math.Sin((projectile.timeLeft + k) / 15f) / 3f);
                    Vector2 drawPos = new Vector2(projectile.oldPos[k].X + projectile.width / 2, projectile.oldPos[k].Y + projectile.height / 2) - Main.screenPosition;
                    Color   color   = projectile.GetAlpha(drawColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length);
                    spriteBatch.Draw(texture, drawPos, new Rectangle?(), color * 0.5f * alpha, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f) - (((float)Math.PI / 2) * (facingleft ? 0f : -1f)), origin, projectile.scale, facingleft ? effect : SpriteEffects.FlipHorizontally, 0);
                }
                return(false);
            }//Crimson Catastrophe


            if (projectile.ai[1] == (int)JavelinType.SanguineBident || projectile.ai[1] == (int)JavelinType.Thermal)//Sanguine Bident
            {
                Texture2D glow = null;
                if (projectile.ai[1] == (int)JavelinType.Thermal)
                {
                    glow      = ModContent.GetTexture("SGAmod/Items/GlowMasks/ThermalJavelin_Glow");
                    drawColor = Color.White;
                }
                for (int k = 0; k < (stickin < 0 ? projectile.oldPos.Length : 1); k++)
                {
                    Vector2 drawPos = new Vector2(projectile.oldPos[k].X + projectile.width / 2, projectile.oldPos[k].Y + projectile.height / 2) - Main.screenPosition;
                    Color   color   = (projectile.ai[1] == (int)JavelinType.Thermal ? Color.White : projectile.GetAlpha(drawColor)) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length);
                    spriteBatch.Draw(texture, drawPos, new Rectangle?(), color * 0.5f, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f) - (((float)Math.PI / 2) * (facingleft ? 0f : -1f)), origin, projectile.scale, facingleft ? effect : SpriteEffects.FlipHorizontally, 0);
                    if (glow != null)
                    {
                        spriteBatch.Draw(glow, drawPos, new Rectangle?(), color * 0.5f, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f) - (((float)Math.PI / 2) * (facingleft ? 0f : -1f)), origin, projectile.scale, facingleft ? effect : SpriteEffects.FlipHorizontally, 0);
                    }
                }
            }


            Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(), drawColor, projectile.rotation + (facingleft ? (float)(1f * Math.PI) : 0f) - (((float)Math.PI / 2) * (facingleft ? 0f : -1f)), origin, projectile.scale, facingleft ? effect : SpriteEffects.FlipHorizontally, 0);
            return(false);
        }
コード例 #13
0
 public Character(T2 tex, V2 pos, REC?rec, Color color,
                  F rot, V2 org, V2 scale, SE flip, F layer)
     : base(tex, pos, rec, color, rot, org, scale, flip, layer)
 {
 }
コード例 #14
0
 public virtual void ModifyDrawDatas(List <GuardianDrawData> dds, Vector2 Position, Rectangle BodyRect, Rectangle LArmRect, Rectangle RArmRect, Vector2 Origin, Color color, Microsoft.Xna.Framework.Graphics.SpriteEffects seffects)
 {
 }