Пример #1
0
 private void Update()
 {
     if (nowPlayAnimation == null)
     {
         if (mixer.IsValid())
         {
             mixer.Destroy();
         }
         _beforeNowPlayClip = null;
     }
     else if (_beforeNowPlayClip != nowPlayAnimation)
     {
         SetPlayAnimation(nowPlayAnimation, frameSpeed, changeFrameNow);
     }
     SetNextAnimationPlayable();
     if (playableGraph.IsValid() && mixer.IsValid())
     {
         if (frameSpeed <= 0)
         {
             return;
         }
         if (changeWeightFrame > 0)
         {
             mixer.SetInputWeight(0, (1.0f - num) - ((1.0f) - (((float)_nowChangeFrame) / ((float)changeWeightFrame))));
             mixer.SetInputWeight(1, num + ((1.0f) - (((float)_nowChangeFrame) / ((float)changeWeightFrame))));
             if (_nowChangeFrame >= changeWeightFrame)
             {
                 changeWeightFrame = 0;
                 _nowChangeFrame   = 0;
             }
             _nowChangeFrame++;
         }
         else
         {
             mixer.SetInputWeight(0, (1.0f - num));
             mixer.SetInputWeight(1, num);
         }
         playableGraph.Evaluate((1.0f / nowPlayAnimation.frameRate) * frameSpeed);
         nowFrame = (int)(((float)mixer.GetTime() * nowPlayAnimation.frameRate) * frameSpeed);
         //ループ
         if (nowFrame >= (nowPlayAnimation.length * nowPlayAnimation.frameRate * frameSpeed) && nowPlayAnimation.isLooping)
         {
             mixer.SetTime(0);
             _nowPlayAnimation.SetTime(0);
             if (_beforePlayAnimation.IsValid())
             {
                 _beforePlayAnimation.SetTime(0);
             }
         }
     }
 }