private void DrawDebug() { foreach (VisualLine obj in debugLines) { obj.Destroy(); } debugLines.Clear(); if (data.GetDataGeneral().showHelp) { if (line != null) { float lineWidth = .04f; // Take every bubble and draw debug lines from it to the line to help display what's going on. foreach (VisualBubble bubble in trackedBubbles) { if (bubble.visual != null) { DataPoint closestPoint = Utils.GetClosestPointOnLine(line.Start(), line.End(), bubble.Position); float triggerRadius = bubble.Radius; bool isHit = Utils.IsLineTouchingCircle(line.Start(), line.End(), bubble.Position, triggerRadius, GameCore.bubbleRadiusStandard); bool isIntermediate = Utils.IsInRadiusLineRange(line.Start(), line.End(), bubble.Position, triggerRadius); if (closestPoint.IsRealNumber()) { Color color = Color.HSVToRGB(1, .8f, .8f); if (isIntermediate) { color = Color.HSVToRGB(.66f, .8f, .8f); } if (isHit) { color = Color.HSVToRGB(.33f, .8f, .8f); } VisualLine visual = lineManager.CreateLine(bubble.Position, closestPoint, color, lineWidth); debugLines.Add(visual); } } if (bubble.Radius > (GameCore.bubbleRadiusStandard + VisualLineManager.width / 2 + GameCore.widthLeeway) + 0.001f) { DataPoint[] pos = GameCore.DetermineSplits(new DataBubble(bubble.Position, new DataPoint(), speed: 0, BubbleType.Large), line.Start(), line.End()); foreach (DataPoint point in pos) { debugLines.AddRange(lineManager.CreatePlus(point, Color.white)); } } } // Draw extensions on the line itself Vector2 directionUnscaled = new Vector2(line.End().X - line.Start().X, line.End().Y - line.Start().Y); Vector2 direction = directionUnscaled.normalized; Color col = new Color(.3f, .3f, .3f, .03f); float length = 50f; debugLines.Add(lineManager.CreateLine(line.Start(), line.Start() + new DataPoint(-direction * length), col, lineWidth)); debugLines.Add(lineManager.CreateLine(line.End(), line.End() + new DataPoint(direction * length), col, lineWidth)); } // Screen boundary debugging DataPoint screenSize = inputManager.ScreenSizeWorld(); Color borderColor = new Color(1f, .7f, .8f); float borderThickness = 0.1f; debugLines.Add(lineManager.CreateLine(new DataPoint(-screenSize.X, screenSize.Y), new DataPoint(-screenSize.X, -screenSize.Y), borderColor, borderThickness)); // left debugLines.Add(lineManager.CreateLine(new DataPoint(screenSize.X, screenSize.Y), new DataPoint(screenSize.X, -screenSize.Y), borderColor, borderThickness)); // right debugLines.Add(lineManager.CreateLine(new DataPoint(-screenSize.X, screenSize.Y), new DataPoint(screenSize.X, screenSize.Y), borderColor, borderThickness)); // top debugLines.Add(lineManager.CreateLine(new DataPoint(-screenSize.X, -screenSize.Y), new DataPoint(screenSize.X, -screenSize.Y), borderColor, borderThickness)); // bottom } }