Exemple #1
0
        public static void DrawAura(MyPlayer modPlayer, AuraAnimationInfo aura)
        {
            Player    player           = modPlayer.player;
            Texture2D texture          = aura.GetTexture();
            Rectangle textureRectangle = new Rectangle(0, aura.GetHeight() * modPlayer.AuraCurrentFrame, texture.Width, aura.GetHeight());
            float     scale            = aura.GetAuraScale(modPlayer);
            Tuple <float, Vector2> rotationAndPosition = aura.GetAuraRotationAndPosition(modPlayer);
            float   rotation = rotationAndPosition.Item1;
            Vector2 position = rotationAndPosition.Item2;

            SamplerState samplerState = Main.DefaultSamplerState;

            if (player.mount.Active)
            {
                samplerState = Main.MountedSamplerState;
            }

            Main.spriteBatch.End();
            Main.spriteBatch.Begin(SpriteSortMode.Immediate, aura.BlendState, samplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);

            // custom draw routine
            Main.spriteBatch.Draw(texture, position - Main.screenPosition, textureRectangle, Color.White, rotation, new Vector2(aura.GetWidth(), aura.GetHeight()) * 0.5f, scale, SpriteEffects.None, 0f);

            Main.spriteBatch.End();
            Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, samplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
        }
Exemple #2
0
        public static void DoFabulousDust(MyPlayer modPlayer, AuraAnimationInfo aura)
        {
            var position = aura.GetAuraRotationAndPosition(modPlayer).Item2;

            if (Main.rand.NextFloat() < 0.5f)
            {
                Dust dust = Dust.NewDustDirect(position, aura.GetWidth(), aura.GetHeight(), 91, 0f, 0f, 0, new Color(Main.DiscoColor.R, Main.DiscoColor.G, Main.DiscoColor.B), 0.75f);
                dust.noGravity = true;
            }
            if (Main.rand.NextFloat() < 0.25f)
            {
                Dust dust = Dust.NewDustDirect(position, aura.GetWidth(), aura.GetHeight(), 91, 0f, 0f, 0, new Color(Main.DiscoColor.R, Main.DiscoColor.G, Main.DiscoColor.B), 0.25f);
                dust.noGravity = true;
            }
        }
Exemple #3
0
        public static void DrawAura(this MyPlayer modPlayer, AuraAnimationInfo aura)
        {
            Player    player           = modPlayer.player;
            Texture2D texture          = aura.GetTexture();
            Rectangle textureRectangle = new Rectangle(0, aura.GetHeight() * modPlayer.auraCurrentFrame, texture.Width, aura.GetHeight());
            float     scale            = aura.GetAuraScale(modPlayer);
            Tuple <float, Vector2> rotationAndPosition = aura.GetAuraRotationAndPosition(modPlayer);
            float   rotation = rotationAndPosition.Item1;
            Vector2 position = rotationAndPosition.Item2;

            AnimationHelper.SetSpriteBatchForPlayerLayerCustomDraw(aura.blendState, player.GetPlayerSamplerState());

            // custom draw routine
            Main.spriteBatch.Draw(texture, position - Main.screenPosition, textureRectangle, Color.White, rotation, new Vector2(aura.GetWidth(), aura.GetHeight()) * 0.5f, scale, SpriteEffects.None, 0f);

            AnimationHelper.ResetSpriteBatchForPlayerDrawLayers(player.GetPlayerSamplerState());
        }
Exemple #4
0
        public static void DoChargeDust(MyPlayer modPlayer, AuraAnimationInfo auraInfo)
        {
            var position = auraInfo.GetAuraRotationAndPosition(modPlayer).Item2;

            for (int d = 0; d < 1; d++)
            {
                if (Main.rand.NextFloat() < 0.5f)
                {
                    Dust dust = Dust.NewDustDirect(position, auraInfo.GetWidth(), auraInfo.GetHeight(), 63, 0f, 0f, 0, new Color(255, 255, 255), 0.75f);
                    dust.noGravity = true;
                }
                if (Main.rand.NextFloat() < 0.25f)
                {
                    Dust dust = Dust.NewDustDirect(position, auraInfo.GetWidth(), auraInfo.GetHeight(), 63, 0f, 0f, 0, new Color(255, 255, 255), 1.5f);
                    dust.noGravity = true;
                }
            }
        }