예제 #1
0
 public IEnumerator CheckAnimationChange(Action <int, bool> StateChanged)
 {
     while (true)
     {
         AnimatorStateInfo currentAnimatorStateInfo = this.m_animator.GetCurrentAnimatorStateInfo(0);
         this.passTime += Time.get_deltaTime();
         if (this.passTime >= currentAnimatorStateInfo.get_length())
         {
             int introduced3 = currentAnimatorStateInfo.get_nameHash();
             StateChanged(introduced3, currentAnimatorStateInfo.get_loop());
             this.passTime = 0f;
             yield return(new WaitForFixedUpdate());
         }
         yield return(new WaitForFixedUpdate());
     }
 }
예제 #2
0
 private void Update()
 {
     //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
     //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
     if (!loop || loopEnd)
     {
         if (waitTime > 0f)
         {
             timer += Time.get_deltaTime();
             if (timer < waitTime)
             {
                 return;
             }
         }
         if (waitParticlePlaying)
         {
             int i = 0;
             for (int num = particles.Length; i < num; i++)
             {
                 ParticleSystem val = particles[i];
                 if (val != null && val.get_isPlaying())
                 {
                     val.Stop(true);
                     return;
                 }
             }
         }
         if (waitAnimationPlaying && animator != null)
         {
             if (animator.IsInTransition(0))
             {
                 return;
             }
             AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
             if (!currentAnimatorStateInfo.get_loop() && currentAnimatorStateInfo.get_normalizedTime() < 1f)
             {
                 return;
             }
         }
         DestroyGameObject();
     }
 }
예제 #3
0
    private void Update()
    {
        if (!this.valid)
        {
            return;
        }
        if (this.layerMixModes.Length != this.animator.get_layerCount())
        {
            Array.Resize <SkeletonAnimator.MixMode>(ref this.layerMixModes, this.animator.get_layerCount());
        }
        float num = Time.get_time() - this.lastTime;

        this.skeleton.Update(Time.get_deltaTime());
        int layerCount = this.animator.get_layerCount();

        for (int i = 0; i < layerCount; i++)
        {
            float num2 = this.animator.GetLayerWeight(i);
            if (i == 0)
            {
                num2 = 1f;
            }
            AnimatorStateInfo        currentAnimatorStateInfo = this.animator.GetCurrentAnimatorStateInfo(i);
            AnimatorStateInfo        nextAnimatorStateInfo    = this.animator.GetNextAnimatorStateInfo(i);
            AnimatorClipInfo[]       currentAnimatorClipInfo  = this.animator.GetCurrentAnimatorClipInfo(i);
            AnimatorClipInfo[]       nextAnimatorClipInfo     = this.animator.GetNextAnimatorClipInfo(i);
            SkeletonAnimator.MixMode mixMode = this.layerMixModes[i];
            if (mixMode == SkeletonAnimator.MixMode.AlwaysMix)
            {
                for (int j = 0; j < currentAnimatorClipInfo.Length; j++)
                {
                    AnimatorClipInfo animatorClipInfo = currentAnimatorClipInfo[j];
                    float            num3             = animatorClipInfo.get_weight() * num2;
                    if (num3 != 0f)
                    {
                        float num4 = currentAnimatorStateInfo.get_normalizedTime() * animatorClipInfo.get_clip().get_length();
                        this.animationTable.get_Item(this.GetAnimationClipNameHashCode(animatorClipInfo.get_clip())).Mix(this.skeleton, Mathf.Max(0f, num4 - num), num4, currentAnimatorStateInfo.get_loop(), null, num3);
                    }
                }
                if (nextAnimatorStateInfo.get_fullPathHash() != 0)
                {
                    for (int k = 0; k < nextAnimatorClipInfo.Length; k++)
                    {
                        AnimatorClipInfo animatorClipInfo2 = nextAnimatorClipInfo[k];
                        float            num5 = animatorClipInfo2.get_weight() * num2;
                        if (num5 != 0f)
                        {
                            float num6 = nextAnimatorStateInfo.get_normalizedTime() * animatorClipInfo2.get_clip().get_length();
                            this.animationTable.get_Item(this.GetAnimationClipNameHashCode(animatorClipInfo2.get_clip())).Mix(this.skeleton, Mathf.Max(0f, num6 - num), num6, nextAnimatorStateInfo.get_loop(), null, num5);
                        }
                    }
                }
            }
            else if (mixMode >= SkeletonAnimator.MixMode.MixNext)
            {
                int l;
                for (l = 0; l < currentAnimatorClipInfo.Length; l++)
                {
                    AnimatorClipInfo animatorClipInfo3 = currentAnimatorClipInfo[l];
                    float            num7 = animatorClipInfo3.get_weight() * num2;
                    if (num7 != 0f)
                    {
                        float num8 = currentAnimatorStateInfo.get_normalizedTime() * animatorClipInfo3.get_clip().get_length();
                        this.animationTable.get_Item(this.GetAnimationClipNameHashCode(animatorClipInfo3.get_clip())).Apply(this.skeleton, Mathf.Max(0f, num8 - num), num8, currentAnimatorStateInfo.get_loop(), null);
                        break;
                    }
                }
                while (l < currentAnimatorClipInfo.Length)
                {
                    AnimatorClipInfo animatorClipInfo4 = currentAnimatorClipInfo[l];
                    float            num9 = animatorClipInfo4.get_weight() * num2;
                    if (num9 != 0f)
                    {
                        float num10 = currentAnimatorStateInfo.get_normalizedTime() * animatorClipInfo4.get_clip().get_length();
                        this.animationTable.get_Item(this.GetAnimationClipNameHashCode(animatorClipInfo4.get_clip())).Mix(this.skeleton, Mathf.Max(0f, num10 - num), num10, currentAnimatorStateInfo.get_loop(), null, num9);
                    }
                    l++;
                }
                l = 0;
                if (nextAnimatorStateInfo.get_fullPathHash() != 0)
                {
                    if (mixMode == SkeletonAnimator.MixMode.SpineStyle)
                    {
                        while (l < nextAnimatorClipInfo.Length)
                        {
                            AnimatorClipInfo animatorClipInfo5 = nextAnimatorClipInfo[l];
                            float            num11             = animatorClipInfo5.get_weight() * num2;
                            if (num11 != 0f)
                            {
                                float num12 = nextAnimatorStateInfo.get_normalizedTime() * animatorClipInfo5.get_clip().get_length();
                                this.animationTable.get_Item(this.GetAnimationClipNameHashCode(animatorClipInfo5.get_clip())).Apply(this.skeleton, Mathf.Max(0f, num12 - num), num12, nextAnimatorStateInfo.get_loop(), null);
                                break;
                            }
                            l++;
                        }
                    }
                    while (l < nextAnimatorClipInfo.Length)
                    {
                        AnimatorClipInfo animatorClipInfo6 = nextAnimatorClipInfo[l];
                        float            num13             = animatorClipInfo6.get_weight() * num2;
                        if (num13 != 0f)
                        {
                            float num14 = nextAnimatorStateInfo.get_normalizedTime() * animatorClipInfo6.get_clip().get_length();
                            this.animationTable.get_Item(this.GetAnimationClipNameHashCode(animatorClipInfo6.get_clip())).Mix(this.skeleton, Mathf.Max(0f, num14 - num), num14, nextAnimatorStateInfo.get_loop(), null, num13);
                        }
                        l++;
                    }
                }
            }
        }
        if (this._UpdateLocal != null)
        {
            this._UpdateLocal(this);
        }
        this.skeleton.UpdateWorldTransform();
        if (this._UpdateWorld != null)
        {
            this._UpdateWorld(this);
            this.skeleton.UpdateWorldTransform();
        }
        if (this._UpdateComplete != null)
        {
            this._UpdateComplete(this);
        }
        this.lastTime = Time.get_time();
    }
 public void Update()
 {
     //IL_002c: Unknown result type (might be due to invalid IL or missing references)
     //IL_003d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0042: Unknown result type (might be due to invalid IL or missing references)
     //IL_0117: Unknown result type (might be due to invalid IL or missing references)
     //IL_011c: Expected O, but got Unknown
     //IL_019a: Unknown result type (might be due to invalid IL or missing references)
     //IL_019f: Expected O, but got Unknown
     //IL_01cf: Unknown result type (might be due to invalid IL or missing references)
     //IL_01e0: Unknown result type (might be due to invalid IL or missing references)
     if (!(animator == null))
     {
         bool flag = animator.IsInTransition(0);
         AnimatorStateInfo info = (!flag) ? animator.GetCurrentAnimatorStateInfo(0) : animator.GetNextAnimatorStateInfo(0);
         if ((curHash != info.get_fullPathHash() && !waitChange) || (curHash == info.get_fullPathHash() && waitChange))
         {
             if (waitChange)
             {
                 waitChange = false;
             }
             else
             {
                 if (curDatas != null && lastSpeed > 0f)
                 {
                     float num = Time.get_deltaTime() * lastSpeed + lastNormalizedTime;
                     Forward(num - beginTime + curMargin);
                 }
                 OnChangeAnim(info.get_fullPathHash(), false);
             }
             if (curDatas == null)
             {
                 return;
             }
             if (!flag)
             {
                 changeDelay      = true;
                 changeTransition = false;
                 return;
             }
             AnimatorClipInfo[] nextAnimatorClipInfo = animator.GetNextAnimatorClipInfo(0);
             if (nextAnimatorClipInfo.Length == 0)
             {
                 changeDelay      = true;
                 changeTransition = true;
                 return;
             }
             ChangeAnimClip(ref info, nextAnimatorClipInfo[0].get_clip());
         }
         else if (changeDelay)
         {
             AnimatorClipInfo[] array = (!changeTransition) ? animator.GetCurrentAnimatorClipInfo(0) : animator.GetNextAnimatorClipInfo(0);
             if (array.Length <= 0)
             {
                 return;
             }
             ChangeAnimClip(ref info, array[0].get_clip());
         }
         if (!waitChange && curDatas != null && (!flag || !((ValueType)animator.GetCurrentAnimatorStateInfo(0)).Equals((object)animator.GetNextAnimatorStateInfo(0))))
         {
             float num2 = info.get_normalizedTime() * curTimeScale;
             if (animator.get_speed() >= 0f)
             {
                 if (num2 >= lastTime && info.get_loop())
                 {
                     Forward(curLength);
                     beginTime = lastTime;
                     lastTime += curLength;
                     curTime   = 0f;
                     curIndex  = 0;
                 }
                 else if (lastNormalizedTime > num2)
                 {
                     ExecuteLastEvent(false);
                     beginTime = 0f;
                     lastTime  = curLength;
                     curTime   = 0f;
                     curIndex  = 0;
                 }
                 lastNormalizedTime = num2;
                 lastSpeed          = animator.get_speed();
                 Forward(num2 - beginTime + curMargin);
             }
         }
     }
 }