Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (filePath != currentFilePath)
     {
         ReadFile();
     }
     if (!done)
     {
         float timerVal = timer.Update();       // Find the time from 0 to 1 representing the traveler's position on the spline.
         if (timerVal != NO_REDRAW)             // If a position change is necessary.
         {
             if (timerVal == END_OF_SPLINE)     // If the animation has ended.
             {
                 SetTransforms(1);
                 // Move onto the next spline in the list if there are any more.
                 curSplineIndex++;
                 if (curSplineIndex < splines.Count)
                 {
                     curSpline = splines[curSplineIndex].GetComponent <SplineObj>();
                     SetTransforms(0);
                     timer = new Timer(curSpline.time);
                 }
                 else
                 {
                     EndAnimation();
                 }
             }
             else
             {
                 SetTransforms(timerVal);
                 //Debug.Log(string.Format("Now Moving to t={0}, at location: {1}", timerVal, transform.position));
             }
         }
     }
 }
Пример #2
0
 void StartAnimation()
 {
     curSplineIndex = 0;
     curSpline      = splines[curSplineIndex].GetComponent <SplineObj>();
     SetTransforms(0);
     timer = new Timer(curSpline.time);
 }