using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIFunctionMap : BaseMeshEffect
{
    public Vector3 center;
    public List<Vector3> vertex = new List<Vector3>();
    private UIVertex vt;

    public Color Color;


    public override void ModifyMesh(VertexHelper vh)
    {
        if (!IsActive() || vh.currentVertCount == 0)
        {
            return;
        }


        int indexCount = vertex.Count;
        vh.Clear();
        vh.AddVert(center, Color, Vector4.zero);
        // vh.FillMesh(mesh);
        for (int i = 0; i < indexCount; i++)
        {
            // vt.position = vertex[i];

            vh.AddVert(vertex[i], Color, Vector4.zero);
        }

        for (int i = 1; i < indexCount; i++)
        {
            vh.AddTriangle(0, i, i + 1);
        }
        vh.AddTriangle(0, indexCount, 1);
    }
}