Beispiel #1
0
        public static IAnimationEventAttribute OnCreate(string text)
        {
            SendAniEventAttribute attribute = new SendAniEventAttribute();

            AnimationEventUtil.Deserialize(text, ref attribute);

            return(attribute);
        }
        public void UpdateEvents(float animNormalizedTime, bool looping /*, AActor actor, AController controller*/)
        {
            if (null == m_currentState)
            {
                return;
            }

            if (null == m_currentState.EventList)
            {
                return;
            }

            if (m_currentState.EventList.Count <= 0)
            {
                return;
            }

            int   currenttimes          = (int)(animNormalizedTime / 1f);
            float currentNormalizedTime = animNormalizedTime % 1.0f;

            if (m_playtimes != currenttimes && looping)
            {
                m_playtimes = currenttimes;
                ResetAniTime();
            }

            // TODO: do more optimization with last fired event index
            for (int i = 0; i < m_currentState.EventList.Count; ++i)
            {
                AnimationEventInfo animationEventInfo = m_currentState.EventList[i];

                if (animationEventInfo.NomalizeTime < currentNormalizedTime && !m_sentactorEvents[i])
                {
                    m_sentactorEvents[i] = true;

                    m_animationEventHandler.OnAnimationEvent(animationEventInfo.FunctionName,
                                                             animationEventInfo.attribute);

                    eAnimationEventTypeMask mask =
                        AnimationEventUtil.GetAnimationEventTypeMask(animationEventInfo.FunctionName);
                    EventLogType eventLogType = EventLogType.AnimEvent_Combat;
                    if (mask == eAnimationEventTypeMask.SFX)
                    {
                        eventLogType = EventLogType.AnimEvent_SFX;
                    }
                    else if (mask == eAnimationEventTypeMask.VFX)
                    {
                        eventLogType = EventLogType.AnimEvent_VFX;
                    }
                    EventLogger.Log(eventLogType,
                                    string.Format(
                                        "State[{8}] UpdateEvents[{6}][{7}] ActorName : {0} Event : {1}_{4}, Time1 : {2} NorTime {3} currentNormalizedTime : {5}",
                                        m_animationEventHandler.HandlerName, animationEventInfo.FunctionName, animNormalizedTime,
                                        animationEventInfo.NomalizeTime, animationEventInfo.attribute, currentNormalizedTime, i,
                                        m_sentactorEvents[i], m_currentState.Name));
                }
            }
        }