public AnimationEventState Clone() { AnimationEventState clone = new AnimationEventState(Name); clone.Visible = Visible; clone.isLooping = isLooping; clone.AnimationTime = AnimationTime; clone.clipName = clipName; //clone.m_eventList = m_eventList; for (int i = 0; i < m_eventList.Count; i++) { AnimationEventInfo animationEventInfo = m_eventList[i]; clone.AddAnimationEvent(animationEventInfo.Clone()); } return(clone); }
private static void DeserializeAnimationEvent(string line, AnimationEventState eventState) { string[] tokens = line.Split(charSeparators, System.StringSplitOptions.None); if (tokens.Length >= 4) { string functionName = tokens[0]; int frame = int.Parse(tokens[1]); float time = 0.0f; if (tokens.Length >= 3) { float.TryParse(tokens[2], out time); } string param = ""; if (tokens.Length >= 4) { param = tokens[3]; } bool eventOnExit = false; if (tokens.Length >= 5) { bool.TryParse(tokens[4], out eventOnExit); } AnimationEventInfo animationEventInfo = new AnimationEventInfo(); animationEventInfo.FunctionName = functionName; animationEventInfo.Frame = frame; //animationEvent.Param = param; animationEventInfo.attribute = AnimationEventUtil.CreateAttribute(functionName, param); AnimationEventUtil.Serialize(out param, animationEventInfo.attribute); animationEventInfo.param = param; animationEventInfo.Time = time; animationEventInfo.EventOnExit = eventOnExit; animationEventInfo.NomalizeTime = time / eventState.AnimationTime; eventState.AddAnimationEvent(animationEventInfo); } }