public static List <int> GetActionEffects(RuntimeAnimatorController controller, string actName) { if (controller == null) { Debug.LogError("controller为空"); return(new List <int>()); } string text = controller.get_name() + "-" + actName; if (!XUtility.effectsTime.ContainsKey(text)) { XUtility.effectsTime.Add(text, new List <int>()); for (int i = 0; i < controller.get_animationClips().Length; i++) { AnimationClip animationClip = controller.get_animationClips()[i]; if (animationClip.get_name().Equals(actName)) { for (int j = 0; j < animationClip.get_events().Length; j++) { AnimationEvent animationEvent = animationClip.get_events()[j]; if (animationEvent.get_functionName().Equals("Effect")) { XUtility.effectsTime.get_Item(text).Add(animationEvent.get_intParameter()); } } } } } return(XUtility.effectsTime.get_Item(text)); }
public bool CurrentAnimationHasLabel(string labelName, StringComparison comparisonType, out int frame) { AnimationEvent[] events = m_currentAnimation.get_events(); int num = events.Length; for (int i = 0; i < num; i++) { AnimationEvent val = events[i]; if (val.get_functionName().Equals("SetLabel") && val.get_stringParameter().Equals(labelName, comparisonType)) { frame = Mathf.FloorToInt(val.get_time() * m_currentAnimation.get_frameRate()); return(true); } } frame = 0; return(false); }