Advertisement
Sigma88Mods

test_vectrosity

Jul 18th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. [KSPAddon(KSPAddon.Startup.Flight, true)]
  2. internal class TestDraw : MonoBehaviour
  3. {
  4. internal static CommPath path;
  5. VectorLine line;
  6.  
  7. void LateUpdate()
  8. {
  9. if (path != null)
  10. {
  11. Debug.Log("SigmaLog: DRAW!");
  12. List<Vector3> points = new List<Vector3>();
  13. path.GetPoints(points);
  14. ScaledSpace.LocalToScaledSpace(points);
  15. CreateLine(ref line, points);
  16. line.SetColor(Color.blue);
  17.  
  18. if (MapView.Draw3DLines)
  19. {
  20. Debug.Log("SigmaLog: DRAW 3D");
  21. line.rectTransform.gameObject.layer = 24;
  22. line.SetWidth(12);
  23. line.Draw3D();
  24. }
  25. else
  26. {
  27. Debug.Log("SigmaLog: DRAW 2D");
  28. line.rectTransform.gameObject.layer = 31;
  29. line.SetWidth(12);
  30. line.Draw();
  31. }
  32. }
  33. }
  34.  
  35. void CreateLine(ref VectorLine l, List<Vector3> points)
  36. {
  37. if (l != null)
  38. {
  39. VectorLine.Destroy(ref l);
  40. }
  41. l = new VectorLine("CommNetUIVectorLine", points, 12, LineType.Discrete);
  42. l.rectTransform.gameObject.layer = 24;
  43. l.material = CommNetUI.TelemetryMaterial;
  44.  
  45. Texture2D blank = new Texture2D(1, 1);
  46. blank.SetPixel(0, 0, Color.white * 0.5f);
  47. blank.Apply();
  48.  
  49. l.texture = blank;
  50. l.smoothColor = true;
  51. l.UpdateImmediate = true;
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement