vectorLine画线
来源:互联网 发布:淘宝大学鹰图学院 编辑:程序博客网 时间:2024/06/06 00:15
using UnityEngine;
using System.Collections;
using Vectrosity;//插件
using System.Collections.Generic;
using System.Collections;
using Vectrosity;//插件
using System.Collections.Generic;
public class DawnLine : MonoBehaviour
{
public Material lineMaterial;
public Transform[] pos; 目标点
private VectorLine line;
private int index = 0;
void Start()
{
line = new VectorLine("line",new List<Vector3>(),lineMaterial,2f,LineType.Continuous); //建立vectorLine的对象
}
public void StartDawnLine()
{
iTween.ValueTo(this.gameObject, iTween.Hash("from", pos[0].position, "to", pos[1].position, "time", 2f, "onupdate", "myupdate"));
StartCoroutine("Wait");//经过2s,不断的实时将两点之间的坐标传给myupdate
}
IEnumerator Wait()
{
public Material lineMaterial;
public Transform[] pos; 目标点
private VectorLine line;
private int index = 0;
void Start()
{
line = new VectorLine("line",new List<Vector3>(),lineMaterial,2f,LineType.Continuous); //建立vectorLine的对象
}
public void StartDawnLine()
{
iTween.ValueTo(this.gameObject, iTween.Hash("from", pos[0].position, "to", pos[1].position, "time", 2f, "onupdate", "myupdate"));
StartCoroutine("Wait");//经过2s,不断的实时将两点之间的坐标传给myupdate
}
IEnumerator Wait()
//这里协程的目的是产生拐弯
{
index++;
if (index<pos.Length-1){
yield return new WaitForSeconds(2);
iTween.ValueTo(this.gameObject, iTween.Hash("from", pos[index].position, "to", pos[index+1].position, "time", 2f, "onupdate", "myupdate"));
StartCoroutine("Wait");
}
}
public void myupdate(Vector3 value)
{
line.points3.Add(value);
line.Draw3D();
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
StartDawnLine();
}
}
}
{
index++;
if (index<pos.Length-1){
yield return new WaitForSeconds(2);
iTween.ValueTo(this.gameObject, iTween.Hash("from", pos[index].position, "to", pos[index+1].position, "time", 2f, "onupdate", "myupdate"));
StartCoroutine("Wait");
}
}
public void myupdate(Vector3 value)
{
line.points3.Add(value);
line.Draw3D();
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
StartDawnLine();
}
}
}
0 0
- vectorLine画线
- 插件VectorLine
- 画线
- 画线
- 画线
- 画线
- 画线
- 画线
- 画线
- mapx 画线
- Arcgis 画线
- 打点画线
- 打点画线
- MFC画线
- opengl画线
- Mapx 画线
- 多线程画线
- JS画线
- System.Data.SqlClient.SqlException= "从 bcp 客户端收到一个对 colid 4 无效的列长度。"
- 移动端开发之APP消息推送
- 【经验总结】tcp_tw_recycle参数引发的故障
- 栈的演示1.
- Make 命令教程
- vectorLine画线
- android studio 如何打包成jar包
- AFNetworking 的核心 AFURLSessionManager(二)
- poj2488 A Knight's Journey
- sphinx 配置文件全解析
- C#编写的获取天气信息
- 一步一步解析集合框架ArrayList源码(2)
- 程序猿男票为何特别想要那个?
- Hive安装与使用