码迷,mamicode.com
首页 > 其他好文 > 详细

haha

时间:2016-12-05 01:49:20      阅读:202      评论:0      收藏:0      [点我收藏+]

标签: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;
    }
}

  

haha

标签:range   random   form   initial   pos   arp   oat   cal   eval   

原文地址:http://www.cnblogs.com/bambomtan/p/6132436.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!