示例#1
0
        /*IEnumerator DoSomething ()
         * {
         *  FishData f;
         *  for (int i; i < sof.Length; ++i)
         *  {
         *      f = sof[i];
         *
         *  }
         *              for (int i = 0; i < 300; ++i) {
         *                      fish.FishFactory.RandomFish (this);
         *                      yield return new WaitForSeconds(1);
         *              }
         *      }*/
        IEnumerator refresh()
        {
            int      i = 0;//数组递增
            FishData fd;
            int      gap = 0;

            delay = currentTime - startTime;//获取当前已逝去时间
            while (true)
            {
                fd = sof[i];
                if (fd.delay > delay)
                {
                    gap    = (int)(fd.delay - delay);
                    delay += gap;
                    yield return(new WaitForSeconds(gap / 1000));
                }
                else
                {
                    GameObject test = GameObject.Instantiate((GameObject)SACache.getObjectWithName("model/fish/" + fd.fishID));
                    FishSwim   fs   = test.AddComponent <FishSwim>();
                    fs.setInfo(graph, fd, delay);
                    ++i;
                }
                if (i >= sof.Count || exit)
                {
                    break;//结束
                }
            }
            StopCoroutine("refresh");
        }
示例#2
0
    void Start()
    {
        rigidbody = GetComponent <Rigidbody> ();

        colliderCount = GetComponents <BoxCollider> ().Length + GetComponents <SphereCollider>().Length + GetComponents <CapsuleCollider>().Length;

        fishSwim = GetComponent <FishSwim> ();
    }
示例#3
0
 void Start()
 {
     fishSwim = GetComponent <FishSwim> ();
 }
 Vector3 startPosition;                  //used to cache the start position of the transform
 void Start()
 {
     bounceObject  = this;
     startPosition = bounceObject.transform.position;
 }