UIFunctionMap.cs 892 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class UIFunctionMap : BaseMeshEffect
  6. {
  7. public Vector3 center;
  8. public List<Vector3> vertex = new List<Vector3>();
  9. private UIVertex vt;
  10. public Color Color;
  11. public override void ModifyMesh(VertexHelper vh)
  12. {
  13. if (!IsActive() || vh.currentVertCount == 0)
  14. {
  15. return;
  16. }
  17. int indexCount = vertex.Count;
  18. vh.Clear();
  19. vh.AddVert(center, Color, Vector4.zero);
  20. // vh.FillMesh(mesh);
  21. for (int i = 0; i < indexCount; i++)
  22. {
  23. // vt.position = vertex[i];
  24. vh.AddVert(vertex[i], Color, Vector4.zero);
  25. }
  26. for (int i = 1; i < indexCount; i++)
  27. {
  28. vh.AddTriangle(0, i, i + 1);
  29. }
  30. vh.AddTriangle(0, indexCount, 1);
  31. }
  32. }