// Unlimited bubbles are positioned in a random orientation private void PopulateUnlimitedBubbles() { if (!internalStateCurrentHasInit) { DataGeneral readOnlyData = data.GetDataGeneral(); int seed = readOnlyData.seed; int level = readOnlyData.level; rand = new Utils.WichmannRng(seed + level); bubbles.Clear(); guideLines.Clear(); float bubbleCountFloat = 12.0f * Mathf.Log10(((float)level) + 9.1f) - 9.9f; while (bubbles.Count < bubbleCountFloat) { double x = (rand.Next() - 0.5f) * 2; double y = (rand.Next() - 0.5f) * 2; DataPoint screenSize = inputManager.ScreenSizeWorld(); DataPoint pos = new DataPoint(x * (screenSize.X - bubbleRadiusStandard), y * (screenSize.Y - bubbleRadiusStandard * 2)); bubbles.Add(new DataBubble(new DataPoint(pos))); } events.OnBubblesChange?.Invoke(bubbles); events.OnGuideLinesChange?.Invoke(guideLines); internalStateCurrentHasInit = true; } }
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 } }