标签:range random form initial pos arp oat cal eval
using UnityEngine;
using System.Collections;
public class tes : MonoBehaviour {
public AnimationCurve time;
public float timeSkip = 0.5f;
public int duration = 7;
public int endCount = 0;
float allCount = 0;
public RectTransform[] poss;
public RectTransform eff;
// Use this for initialization
void Start () {
// endCount = Random.Range(0, 10);
allCount = duration * 11 + endCount;
// timeSkip = duration / allCount;
}
float timeTmp = 0;
IEnumerator StarRun()
{
yield return 1;
}
public bool begin = false;
public bool start
{
get
{
return begin;
}
set
{
begin = value;
allCount = duration * 11 + endCount;
}
}
// Update is called once per frame
void Update()
{
if (start)
{
if(runCoun> allCount)
{
start = false;
runCoun = 0;
count = 0;
}
timeTmp += Time.deltaTime;
if (timeTmp >= tags)
{
// Debug.Log("timeSkip:"+tag+" "+"runCount:"+ runCoun);
eff.localPosition = GetNext();
timeTmp = 0;
}
}
}
int count = 0;
public int runCoun = 0;
float tags = 0;
Vector3 GetNext()
{
// Debug.Log("time.Evaluate(" + runCoun / allCount + ")="+time.Evaluate(runCoun / allCount));
tags = timeSkip * time.Evaluate(runCoun / allCount);
Debug.Log("tags=" + tags);
if (count>10)
{
count = 0;
}
runCoun++;
return poss[count++].localPosition;
}
}
标签:range random form initial pos arp oat cal eval
原文地址:http://www.cnblogs.com/bambomtan/p/6132436.html