private void DrawGraph() { UltiDraw.Begin(); Color[] colors = UltiDraw.GetRainbowColors(Values.Length); Vector2 pivot = Rect.GetCenter(); float radius = 0.2f * Rect.W; UltiDraw.GUICircle(pivot, Rect.W * 1.05f, UltiDraw.Gold); UltiDraw.GUICircle(pivot, Rect.W, UltiDraw.White); Vector2[] anchors = new Vector2[Values.Length]; for (int i = 0; i < Values.Length; i++) { float step = (float)i / (float)Values.Length; anchors[i] = Rect.ToScreen(new Vector2(Mathf.Cos(step * 2f * Mathf.PI), Mathf.Sin(step * 2f * Mathf.PI))); } Vector2[] positions = new Vector2[Frames]; for (int i = 0; i < Values.Length; i++) { int _index = 0; foreach (float value in Values[i]) { positions[_index] += value * anchors[i]; _index += 1; } } for (int i = 1; i < positions.Length; i++) { UltiDraw.GUILine(pivot + positions[i - 1], pivot + positions[i], 0.1f * radius, UltiDraw.Black.Opacity((float)(i + 1) / (float)positions.Length)); } for (int i = 0; i < anchors.Length; i++) { UltiDraw.GUILine(pivot + positions.Last(), pivot + anchors[i], 0.1f * radius, colors[i].Opacity(Weights[i])); UltiDraw.GUICircle(pivot + anchors[i], Mathf.Max(0.5f * radius, Weights[i].Normalize(0f, 1f, 0.5f, 1f) * radius), Color.Lerp(UltiDraw.Black, colors[i], Weights[i])); } UltiDraw.GUICircle(pivot + positions.Last(), 0.5f * radius, UltiDraw.Purple); UltiDraw.End(); }
public override void GUI(Camera canvas = null) { if (DrawGUI) { UltiDraw.Begin(canvas); UltiDraw.OnGUILabel(Rect.GetCenter() + new Vector2(Rect.W / 2f, Rect.H + 0.04f), Rect.ToScreen(new Vector2(1f, 0.25f)), 0.02f, "Phases", UltiDraw.Black); float xMin = Rect.X; float xMax = Rect.X + Rect.W; float yMin = Rect.Y; float yMax = Rect.Y + Rect.H; for (int b = 0; b < Bones.Length; b++) { float w = (float)b / (float)(Bones.Length - 1); float vertical = w.Normalize(0f, 1f, yMax, yMin); float height = 0.95f * (yMax - yMin) / (Bones.Length - 1); float border = 0.025f * (yMax - yMin) / (Bones.Length - 1); if (!Active[b]) { UltiDraw.OnGUILabel(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax - xMin, height), 0.015f, "Disabled", UltiDraw.White, UltiDraw.None); } } UltiDraw.End(); } }
public override void GUI(Camera canvas = null) { if (DrawGUI) { UltiDraw.Begin(canvas); UltiDraw.OnGUILabel(rect.GetCenter() + rect.ToScreen(new Vector2(0f, 1.25f)), rect.ToScreen(new Vector2(1f, 0.25f)), 0.02f, "Ball Control", UltiDraw.Black); UltiDraw.OnGUILabel(rect.GetCenter() + rect.ToScreen(new Vector2(-1.175f, 1f)), rect.ToScreen(new Vector2(1f, 0.25f)), 0.015f, "Height", UltiDraw.Black); UltiDraw.OnGUILabel(rect.GetCenter() + rect.ToScreen(new Vector2(1.175f, 1f)), rect.ToScreen(new Vector2(1f, 0.25f)), 0.015f, "Speed", UltiDraw.Black); UltiDraw.OnGUILabel(opponent.GetCenter() + new Vector2(0f, opponent.H + 0.02f), rect.ToScreen(new Vector2(1f, 0.25f)), 0.0175f, "Opponent", UltiDraw.Black); UltiDraw.End(); } }