private static void drawHistory(CounterStacksCollection history, List <HistoryInfoBean> historyInfoBeans, int i) { float nextTimeAt = -1; for (int j = 0; j < history.stacks.Count; j++) { Dictionary <string, float> currentMoment = history.getRelative(history.stacks.Count - j); float h1 = 60f; float w = 2; // int count = 4;//чтобы разные истории совпадали по шагам int count = historyInfoBeans.Count; float x = j * (count * (w + 1) + 3) + 30; float y = Camera.current.pixelHeight - (i + 1) * h1; int cur = 0; if (x > nextTimeAt) { if (currentMoment.ContainsKey("time")) { //Vector3 p = Camera.current.ScreenToWorldPoint(new Vector3(x, y - 20, 10)); //Handles.Label(p, currentMoment["time"].ToString("F3"), new GUIStyle {richText = true}); } nextTimeAt = x + 100; } Gizmos.color = Color.white; for (int hbi = 0; hbi < historyInfoBeans.Count; hbi++) { HistoryInfoBean hb = historyInfoBeans[hbi]; Gizmos.color = hb.color; drawValue(x, cur++, y, w, 20, hb.name, currentMoment); } } }
private static void OnDrawGizmos(MoveenStepper5 component, GizmoType gizmoType) { if (!component.isActiveAndEnabled) { return; } Vector3 distSum = new Vector3(); for (var i = 0; i < component.engine.steps.Count; i++) { var step = component.engine.steps[i]; //step dial float r1 = 10; float r2 = 20; float airTime = step.lastStepLen / step.legSpeed * 1.5f; float earthTime = step.lastStepLen / step.bodySpeed.length(); float dockedAngle = MyMath.PI * 2 * earthTime / (airTime + earthTime); // float angle = MyMath.PI; if (component.engine.showPhaseDials) { Vector2 dialCenter = new Vector2(r2 * 2 + i * (r2 * 2.5f), r2 * 2); Gizmos.color = Color.green; UnityEditorUtils.fillStripe2D(dialCenter, r1, r2, 20); Gizmos.color = Color.red; UnityEditorUtils.fillArcStripe2D(dialCenter, r1, r2, 20, MyMath.PI * 2 * 3 / 4 - dockedAngle / 2, MyMath.PI * 2 * 3 / 4 + dockedAngle / 2); float a2; if (step.dockedState) { a2 = MyMath.PI * 2 * 3 / 4 - dockedAngle / 2 + dockedAngle * step.progress; } else { a2 = MyMath.PI * 2 * 3 / 4 + dockedAngle / 2 + (MyMath.PI * 2 - dockedAngle) * step.progress; } Gizmos.color = new Color(0.8f, 0.8f, 0.8f, 1); UnityEditorUtils.fillArcStripe2D(dialCenter, r2 - 5, r2 + 2, 5, a2, a2 + step.beFaster); Gizmos.color = step.dockedState ? Color.white : Color.black; drawNeedle(a2, dialCenter, r1, r2); } Gizmos.color = Color.green; if (component.engine.collectSteppingHistory && Application.isPlaying) { CounterStacksCollection history = step.paramHistory; drawHistory(history, historyBeans, i); } } distSum = MyMath.max(distSum, new Vector3(0.5f, 0.5f, 0.5f)); Gizmos.color = Color.yellow; Gizmos.matrix = Matrix4x4.TRS(component.targetPos, component.targetRot, new Vector3(1, 1, 1)); Gizmos.DrawWireCube(Vector3.zero, distSum * 0.2f); Gizmos.matrix = Matrix4x4.identity; Gizmos.color = Color.green; if (component.hip != null) { Gizmos.matrix = Matrix4x4.TRS(component.engine.hipPosAbs, component.engine.hipRotAbs, new Vector3(1, 1, 1)); Gizmos.DrawWireCube(Vector3.zero, distSum / 2); Gizmos.matrix = Matrix4x4.identity; } Gizmos.matrix = Matrix4x4.TRS(component.transform.position, component.transform.rotation, new Vector3(1, 1, 1)); UnityEditorUtils.arrow(); Gizmos.DrawWireCube(Vector3.zero, distSum); Gizmos.matrix = Matrix4x4.identity; if (Application.isPlaying) { Gizmos.color = Color.cyan; Gizmos.DrawWireSphere(component.engine.imBody, 0.2f); Gizmos.color = new Color(0, 0, 1); Gizmos.DrawWireSphere(component.engine.imCenter, 0.4f); Gizmos.color = Color.green; Gizmos.DrawWireSphere(component.engine.virtualForLegs, 0.35f); } Gizmos.color = new Color(1, 0.0f, 1); Gizmos.DrawWireSphere(component.engine.calculatedCOG, 0.1f); }