using UnityEngine;

using System.Collections;

using Vectrosity;

public class StudyVectrosity : MonoBehaviour

{

//线条材质

public Material myMaterial;

private VectorLine energyLine;

private Vector2[] energyLinePoints;

private int index = 0;

// Use this for initialization

void Start()

{

energyLinePoints = new Vector2[300];

energyLine = new VectorLine("Energy", energyLinePoints, myMaterial, 3f, LineType.Continuous, Joins.Weld);

}

// Update is called once per frame

void Update()

{

}

void LateUpdate()

{

if (index < energyLinePoints.Length)

{

//给数组赋值

energyLinePoints[index].x = index * 5 + 100;

energyLinePoints[index].y = Mathf.Sin(index * 0.1f) * 60 + Screen.height * 0.5f;

//限制min max ,去除与之连接的那条线的

energyLine.minDrawIndex = index - 1;

energyLine.maxDrawIndex = index;

//绘制

energyLine.Draw();

index++;

}

}

}