public static List <MecanimEvent> GetEvents(Dictionary <int, Dictionary <int, Dictionary <int, List <MecanimEvent> > > > contextLoadedData, Dictionary <int, Dictionary <int, AnimatorStateInfo> > contextLastStates, int animatorControllerId, Animator animator) { int hashCode = animator.GetHashCode(); if (!contextLastStates.ContainsKey(hashCode)) { contextLastStates[hashCode] = new Dictionary <int, AnimatorStateInfo>(); } int layerCount = animator.layerCount; Dictionary <int, AnimatorStateInfo> dictionary = contextLastStates[hashCode]; for (int i = 0; i < layerCount; i++) { if (!dictionary.ContainsKey(i)) { dictionary[i] = default(AnimatorStateInfo); } AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(i); int num = (int)dictionary[i].normalizedTime; int num2 = (int)currentAnimatorStateInfo.normalizedTime; float normalizedTimeStart = dictionary[i].normalizedTime - (float)num; float normalizedTimeEnd = currentAnimatorStateInfo.normalizedTime - (float)num2; if (dictionary[i].fullPathHash == currentAnimatorStateInfo.fullPathHash) { if (currentAnimatorStateInfo.loop) { if (num == num2) { MecanimEventManager.CollectEvents(MecanimEventManager.allEvents, contextLoadedData, animator, animatorControllerId, i, currentAnimatorStateInfo.fullPathHash, currentAnimatorStateInfo.tagHash, normalizedTimeStart, normalizedTimeEnd, false); } else { MecanimEventManager.CollectEvents(MecanimEventManager.allEvents, contextLoadedData, animator, animatorControllerId, i, currentAnimatorStateInfo.fullPathHash, currentAnimatorStateInfo.tagHash, normalizedTimeStart, 1.00001f, false); MecanimEventManager.CollectEvents(MecanimEventManager.allEvents, contextLoadedData, animator, animatorControllerId, i, currentAnimatorStateInfo.fullPathHash, currentAnimatorStateInfo.tagHash, 0f, normalizedTimeEnd, false); } } else { float num3 = Mathf.Clamp01(dictionary[i].normalizedTime); float num4 = Mathf.Clamp01(currentAnimatorStateInfo.normalizedTime); if (num == 0 && num2 == 0) { if (num3 != num4) { MecanimEventManager.CollectEvents(MecanimEventManager.allEvents, contextLoadedData, animator, animatorControllerId, i, currentAnimatorStateInfo.fullPathHash, currentAnimatorStateInfo.tagHash, num3, num4, false); } } else if (num == 0 && num2 > 0) { MecanimEventManager.CollectEvents(MecanimEventManager.allEvents, contextLoadedData, animator, animatorControllerId, i, dictionary[i].fullPathHash, dictionary[i].tagHash, num3, 1.00001f, false); } } } else { MecanimEventManager.CollectEvents(MecanimEventManager.allEvents, contextLoadedData, animator, animatorControllerId, i, currentAnimatorStateInfo.fullPathHash, currentAnimatorStateInfo.tagHash, 0f, normalizedTimeEnd, false); if (!dictionary[i].loop) { MecanimEventManager.CollectEvents(MecanimEventManager.allEvents, contextLoadedData, animator, animatorControllerId, i, dictionary[i].fullPathHash, dictionary[i].tagHash, normalizedTimeStart, 1.00001f, true); } } dictionary[i] = currentAnimatorStateInfo; } return(MecanimEventManager.allEvents); }
// Token: 0x0600159D RID: 5533 RVA: 0x00078EA8 File Offset: 0x000770A8 public static ICollection <MecanimEvent> GetEvents(int animatorControllerId, Animator animator) { List <MecanimEvent> list = new List <MecanimEvent>(); int hashCode = animator.GetHashCode(); if (!MecanimEventManager.lastStates.ContainsKey(hashCode)) { MecanimEventManager.lastStates[hashCode] = new Dictionary <int, AnimatorStateInfo>(); } int layerCount = animator.layerCount; Dictionary <int, AnimatorStateInfo> dictionary = MecanimEventManager.lastStates[hashCode]; for (int i = 0; i < layerCount; i++) { if (!dictionary.ContainsKey(i)) { dictionary[i] = default(AnimatorStateInfo); } AnimatorStateInfo animatorStateInfo = dictionary[i]; AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(i); int num = (int)animatorStateInfo.normalizedTime; int num2 = (int)currentAnimatorStateInfo.normalizedTime; float normalizedTimeStart = animatorStateInfo.normalizedTime - (float)num; float normalizedTimeEnd = currentAnimatorStateInfo.normalizedTime - (float)num2; if (animatorStateInfo.nameHash == currentAnimatorStateInfo.nameHash) { if (currentAnimatorStateInfo.loop) { if (num == num2) { list.AddRange(MecanimEventManager.CollectEvents(animator, animatorControllerId, i, currentAnimatorStateInfo.nameHash, currentAnimatorStateInfo.tagHash, normalizedTimeStart, normalizedTimeEnd, false)); } else { list.AddRange(MecanimEventManager.CollectEvents(animator, animatorControllerId, i, currentAnimatorStateInfo.nameHash, currentAnimatorStateInfo.tagHash, normalizedTimeStart, 1.00001f, false)); list.AddRange(MecanimEventManager.CollectEvents(animator, animatorControllerId, i, currentAnimatorStateInfo.nameHash, currentAnimatorStateInfo.tagHash, 0f, normalizedTimeEnd, false)); } } else { float num3 = Mathf.Clamp01(animatorStateInfo.normalizedTime); float num4 = Mathf.Clamp01(currentAnimatorStateInfo.normalizedTime); if (num == 0 && num2 == 0) { if (num3 != num4) { list.AddRange(MecanimEventManager.CollectEvents(animator, animatorControllerId, i, currentAnimatorStateInfo.nameHash, currentAnimatorStateInfo.tagHash, num3, num4, false)); } } else if (num == 0 && num2 > 0) { list.AddRange(MecanimEventManager.CollectEvents(animator, animatorControllerId, i, animatorStateInfo.nameHash, animatorStateInfo.tagHash, num3, 1.00001f, false)); } } } else { list.AddRange(MecanimEventManager.CollectEvents(animator, animatorControllerId, i, currentAnimatorStateInfo.nameHash, currentAnimatorStateInfo.tagHash, 0f, normalizedTimeEnd, false)); if (!animatorStateInfo.loop) { list.AddRange(MecanimEventManager.CollectEvents(animator, animatorControllerId, i, animatorStateInfo.nameHash, animatorStateInfo.tagHash, normalizedTimeStart, 1.00001f, true)); } } dictionary[i] = currentAnimatorStateInfo; } return(list); }