void DrawGraph(TelemetryGraphData graphData, List <SFUAPI> telemetryHistory, Color color, float width, float height) { float graphPosX = width; float graphPosY = height * 0.5f; int xSteps = SimFeedbackUnity.maxTelemetryHistory; float xStepSize = width / (float)xSteps; float lastGraphPosX = graphPosX; float lastGraphPosY = height * 0.5f; float yScale = Mathf.Max(Mathf.Abs(graphData.maxValue), Mathf.Abs(graphData.minValue)); for (int x = SimFeedbackUnity.maxTelemetryHistory; x >= 0; x--) { graphPosY = height * 0.5f; if (x < telemetryHistory.Count) { graphPosY = (height * 0.5f) + ((-graphData.GetAPIValue(telemetryHistory[x]) / yScale) * (height * 0.5f)); } if (x == telemetryHistory.Count - 1) { lastGraphPosY = graphPosY; } Handles.color = color; Handles.DrawLine(new Vector3(lastGraphPosX, lastGraphPosY, 0.0f), new Vector3(graphPosX, graphPosY, 0)); lastGraphPosX = graphPosX; lastGraphPosY = graphPosY; graphPosX -= xStepSize; } }