示例#1
0
        private void DrawLantern(SpriteBatch spriteBatch, Lantern lantern, Color opacity, Vector2 depthScale, Vector2 position, float alpha)
        {
            float y     = (Main.GlobalTimeWrappedHourly % 6f / 6f * ((float)Math.PI * 2f)).ToRotationVector2().Y;
            float scale = y * 0.2f + 0.8f;
            Color color = new Color(255, 255, 255, 0) * _opacity * alpha * scale * 0.4f;

            for (float num = 0f; num < 1f; num += 0.333333343f)
            {
                Vector2 value = new Vector2(0f, 2f).RotatedBy((float)Math.PI * 2f * num + lantern.Rotation) * y;
                spriteBatch.Draw(lantern.Texture, position + value, lantern.GetSourceRectangle(), color, lantern.Rotation, lantern.GetSourceRectangle().Size() / 2f, depthScale.X * 2f, SpriteEffects.None, 0f);
            }
            spriteBatch.Draw(lantern.Texture, position, lantern.GetSourceRectangle(), opacity * _opacity, lantern.Rotation, lantern.GetSourceRectangle().Size() / 2f, depthScale.X * 2f, SpriteEffects.None, 0f);
        }