Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [KSPAddon(KSPAddon.Startup.Flight, true)]
- internal class TestDraw : MonoBehaviour
- {
- internal static CommPath path;
- VectorLine line;
- void LateUpdate()
- {
- if (path != null)
- {
- Debug.Log("SigmaLog: DRAW!");
- List<Vector3> points = new List<Vector3>();
- path.GetPoints(points);
- ScaledSpace.LocalToScaledSpace(points);
- CreateLine(ref line, points);
- line.SetColor(Color.blue);
- if (MapView.Draw3DLines)
- {
- Debug.Log("SigmaLog: DRAW 3D");
- line.rectTransform.gameObject.layer = 24;
- line.SetWidth(12);
- line.Draw3D();
- }
- else
- {
- Debug.Log("SigmaLog: DRAW 2D");
- line.rectTransform.gameObject.layer = 31;
- line.SetWidth(12);
- line.Draw();
- }
- }
- }
- void CreateLine(ref VectorLine l, List<Vector3> points)
- {
- if (l != null)
- {
- VectorLine.Destroy(ref l);
- }
- l = new VectorLine("CommNetUIVectorLine", points, 12, LineType.Discrete);
- l.rectTransform.gameObject.layer = 24;
- l.material = CommNetUI.TelemetryMaterial;
- Texture2D blank = new Texture2D(1, 1);
- blank.SetPixel(0, 0, Color.white * 0.5f);
- blank.Apply();
- l.texture = blank;
- l.smoothColor = true;
- l.UpdateImmediate = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement