private static void DrawCircles(On.Terraria.Main.orig_DrawInfernoRings orig, Main self)
        {
            orig(self);

            //Only draws for local player

            Player        drawPlayer = Main.LocalPlayer;
            ClickerPlayer modPlayer  = drawPlayer.GetModPlayer <ClickerPlayer>();

            if (modPlayer.CanDrawRadius)
            {
                Color outer = modPlayer.clickerRadiusColorDraw * modPlayer.ClickerRadiusColorMultiplier;

                Vector2 center            = new Vector2((int)drawPlayer.Center.X, (int)drawPlayer.Center.Y + drawPlayer.gfxOffY);
                Vector2 motherboardCenter = default;
                int     radius            = (int)modPlayer.ClickerRadiusRealDraw;
                int     motherboardRadius = 0;

                if (modPlayer.SetMotherboardPlaced)
                {
                    //Don't use clickerMotherboardSetPosition here as it includes the wrong player.Center and possibly radius
                    motherboardCenter = center + modPlayer.CalculateMotherboardPosition(radius).Floor();
                    motherboardRadius = (int)modPlayer.ClickerRadiusMotherboardDraw;
                }

                Effect shader = SetupCircleEffect(center, radius, outer, center2: motherboardCenter, radius2: motherboardRadius);
                ApplyToScreenOnce(Main.spriteBatch, shader);
            }
        }
        protected override void Draw(ref PlayerDrawSet drawInfo)
        {
            Player drawPlayer = drawInfo.drawPlayer;

            ClickerPlayer modPlayer = drawPlayer.GetModPlayer <ClickerPlayer>();

            float   alpha   = modPlayer.ClickerRadiusColorMultiplier;
            int     drawX   = (int)(drawPlayer.Center.X - Main.screenPosition.X);
            int     drawY   = (int)(drawPlayer.Center.Y + drawPlayer.gfxOffY - Main.screenPosition.Y);
            Vector2 center  = new Vector2(drawX, drawY);
            Vector2 drawPos = center + modPlayer.CalculateMotherboardPosition(modPlayer.ClickerRadiusRealDraw).Floor();

            Texture2D texture  = backTexture.Value;
            DrawData  drawData = new DrawData(texture, drawPos, null, Color.White * alpha, 0f, texture.Size() / 2, 1f, SpriteEffects.None, 0)
            {
                ignorePlayerRotation = true
            };

            drawInfo.DrawDataCache.Add(drawData);

            texture = glowTexture.Value;
            Rectangle frame = texture.Frame(1, GlowFrameCount, frameY: modPlayer.setMotherboardFrame);

            drawData = new DrawData(texture, drawPos, frame, new Color(255, 255, 255, 100) * modPlayer.setMotherboardAlpha * alpha, 0f, new Vector2(texture.Width / 2, frame.Height / 2), 1f, SpriteEffects.None, 0)
            {
                ignorePlayerRotation = true
            };
            drawInfo.DrawDataCache.Add(drawData);
        }
Esempio n. 3
0
        private static void DrawCircles(On.Terraria.Main.orig_DrawInfernoRings orig, Main self)
        {
            orig(self);

            //Only draws for local player

            Player drawPlayer = Main.LocalPlayer;

            if (Main.gameMenu)
            {
                return;
            }

            ClickerPlayer modPlayer = drawPlayer.GetModPlayer <ClickerPlayer>();

            if (!drawPlayer.dead && modPlayer.clickerSelected)
            {
                if (modPlayer.clickerDrawRadius)
                {
                    float glow = modPlayer.GlowVisual ? 0.6f : 0f;

                    Color outer = modPlayer.clickerRadiusColor * (0.2f + glow);


                    Vector2 center            = new Vector2((int)drawPlayer.Center.X, (int)drawPlayer.Center.Y + drawPlayer.gfxOffY);
                    Vector2 motherboardCenter = default;
                    int     radius            = (int)modPlayer.ClickerRadiusReal;
                    int     motherboardRadius = 0;

                    if (modPlayer.SetMotherboardDraw)
                    {
                        //Don't use clickerMotherboardSetPosition here as it includes the wrong player.Center
                        motherboardCenter = center + modPlayer.CalculateMotherboardPosition().Floor();
                        motherboardRadius = (int)modPlayer.ClickerRadiusMotherboard;
                    }

                    Effect shader = SetupCircleEffect(center, radius, outer, center2: motherboardCenter, radius2: motherboardRadius);
                    ApplyToScreenOnce(Main.spriteBatch, shader);
                }
            }
        }