public void RemoveAnimationEvent(AnimationEventInfo animationEventInfo)
 {
     if (m_eventList.Contains(animationEventInfo))
     {
         m_eventList.Remove(animationEventInfo);
     }
 }
 public void ConvertAnimationEvents()
 {
     for (int i = 0; i < m_eventList.Count; ++i)
     {
         AnimationEventInfo animationEventInfo = m_eventList[i];
         AnimationEventUtil.Serialize(out animationEventInfo.param, animationEventInfo.attribute);
     }
 }
Beispiel #3
0
        public AnimationEventInfo EditorClone()
        {
            AnimationEventInfo animationEventInfo = new AnimationEventInfo();

            animationEventInfo.Frame        = m_frame;
            animationEventInfo.FunctionName = m_functionName;
            animationEventInfo.param        = param;
            animationEventInfo.NomalizeTime = m_nomalizeTime;
            animationEventInfo.Time         = m_time;
            animationEventInfo.EventOnExit  = m_eventOnExit;

            animationEventInfo.attribute = AnimationEventUtil.CreateAttribute(FunctionName, param);
            return(animationEventInfo);
        }
        public bool CheckEvent(int frame, string param)
        {
            for (int i = 0; i < m_eventList.Count; ++i)
            {
                AnimationEventInfo animationEventInfo = m_eventList[i];
                if (animationEventInfo.Frame == frame)
                {
                    if (animationEventInfo.param.Equals(param, StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        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);
            }
        }
Beispiel #7
0
        public static void SetAnimationEventType(AnimationEventInfo animationEventInfo, eAnimationEventType animationEventType)
        {
            if (animationEventInfoList == null)
            {
                //Init();
                Debug.LogError("AnimationEventUtil Init Error");
                return;
            }

            foreach (AnimationEventTypeInfo animationEventTypeInfo in animationEventInfoList)
            {
                if (animationEventTypeInfo.AnimationEventType == animationEventType)
                {
                    animationEventInfo.FunctionName = animationEventTypeInfo.functionName;
                    return;
                }
            }
            animationEventInfo.FunctionName = string.Empty;
        }
 public AnimationEventInfo AddAnimationEvent(AnimationEventInfo animationEventInfo)
 {
     m_eventList.Add(animationEventInfo);
     return(animationEventInfo);
 }