public void CubicVectorBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight, bool isPos)
        {
            int indexOfEvent  = _track.GetIndexOfEvent(_prevEvent);
            int indexOfEvent2 = _track.GetIndexOfEvent(this);
            int eventsCount   = _track.GetEventsCount();
            int num           = indexOfEvent - 1;

            if (num < 0)
            {
                if (_action.loop)
                {
                    num = eventsCount - 1;
                    if (num < 0)
                    {
                        num = 0;
                    }
                }
                else
                {
                    num = 0;
                }
            }
            int num2 = indexOfEvent2 + 1;

            if (num2 >= eventsCount)
            {
                if (_action.loop)
                {
                    num2 = 0;
                }
                else
                {
                    num2 = indexOfEvent2;
                }
            }
            ModifyTransform modifyTransform  = _prevEvent as ModifyTransform;
            ModifyTransform modifyTransform2 = _track.GetEvent(num) as ModifyTransform;
            ModifyTransform modifyTransform3 = _track.GetEvent(num2) as ModifyTransform;

            DebugHelper.Assert(modifyTransform != null && modifyTransform2 != null && modifyTransform3 != null, "��һ�Ѷ���Ӧ��Ϊ��");
            Vector3 vector    = isPos ? modifyTransform.GetTranslation(_action) : modifyTransform.scaling;
            Vector3 vector2   = isPos ? this.GetTranslation(_action) : this.scaling;
            Vector3 formPoint = isPos ? modifyTransform2.GetTranslation(_action) : modifyTransform2.scaling;
            Vector3 lattPoint = isPos ? modifyTransform3.GetTranslation(_action) : modifyTransform3.scaling;
            Vector3 a;
            Vector3 a2;

            CurvlData.CalculateCtrlPoint(formPoint, vector, vector2, lattPoint, out a, out a2);
            float   d       = 1f - _blendWeight;
            Vector3 vector3 = vector * d * d * d + a * 3f * d * d * _blendWeight + a2 * 3f * d * _blendWeight * _blendWeight + vector2 * _blendWeight * _blendWeight * _blendWeight;

            if (isPos)
            {
                _action.GetGameObject(this.targetId).transform.position = vector3;
            }
            else
            {
                _action.GetGameObject(this.targetId).transform.localScale = vector3;
            }
        }
Ejemplo n.º 2
0
 public override void ProcessBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight)
 {
     if ((_action.GetGameObject(this.targetId) != null) && (_prevEvent != null))
     {
         if (this.enableTranslation)
         {
             if (this.cubic)
             {
                 this.CubicVectorBlend(_action, _track, _prevEvent, _blendWeight, true);
             }
             else
             {
                 _action.GetGameObject(this.targetId).transform.position = (Vector3)((this.GetTranslation(_action) * _blendWeight) + ((_prevEvent as ModifyTransform).GetTranslation(_action) * (1f - _blendWeight)));
             }
         }
         if (this.enableRotation)
         {
             _action.GetGameObject(this.targetId).transform.rotation = Quaternion.Slerp((_prevEvent as ModifyTransform).GetRotation(_action), this.GetRotation(_action), _blendWeight);
         }
         if (this.enableScaling)
         {
             if (this.cubic)
             {
                 this.CubicVectorBlend(_action, _track, _prevEvent, _blendWeight, false);
             }
             else
             {
                 _action.GetGameObject(this.targetId).transform.localScale = (Vector3)((this.scaling * _blendWeight) + ((_prevEvent as ModifyTransform).scaling * (1f - _blendWeight)));
             }
         }
     }
 }
Ejemplo n.º 3
0
 public override void ProcessBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight)
 {
     if ((_action.GetGameObject(this.cameraId) != null) && (_prevEvent != null))
     {
         _action.GetGameObject(this.cameraId).transform.rotation = Quaternion.Slerp((_prevEvent as CameraLookAt).GetLookRotation(_action), this.GetLookRotation(_action), _blendWeight);
     }
 }
Ejemplo n.º 4
0
        public override void ProcessBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight)
        {
            GameObject gameObject = _action.GetGameObject(this.targetId);

            if (gameObject != null)
            {
                GameObject actorMesh = gameObject;
                if (this.GetAnimation(gameObject) == null)
                {
                    PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);
                    if (actorHandle != 0)
                    {
                        actorMesh = actorHandle.handle.ActorMesh;
                    }
                    else
                    {
                        actorMesh = null;
                    }
                }
                if ((actorMesh != null) && (_prevEvent != null))
                {
                    AnimationState state = this.GetAnimation(actorMesh)[this.clipName];
                    if (state != null)
                    {
                        state.speed = this.playSpeed * (!this.applyActionSpeed ? 1f : _action.playSpeed.single);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public override void ProcessBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight)
        {
            GameObject gameObject = _action.GetGameObject(this.targetId);

            if (gameObject == null)
            {
                return;
            }
            GameObject gameObject2 = gameObject;

            if (this.GetAnimation(gameObject) == null)
            {
                PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);
                if (actorHandle)
                {
                    gameObject2 = actorHandle.get_handle().ActorMesh;
                }
                else
                {
                    gameObject2 = null;
                }
            }
            if (gameObject2 == null)
            {
                return;
            }
            if (_prevEvent == null)
            {
                return;
            }
            Animation      animation      = this.GetAnimation(gameObject2);
            AnimationState animationState = animation[this.clipName];

            if (animationState == null)
            {
                return;
            }
            animationState.speed = this.playSpeed * ((!this.applyActionSpeed) ? 1f : _action.playSpeed.get_single());
        }
Ejemplo n.º 6
0
 public override void ProcessBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight)
 {
 }
Ejemplo n.º 7
0
        public void Process(int _curTime)
        {
            this.preExcuteTime = this.curTime;
            this.curTime       = _curTime;
            int num = 0;

            if (!this.LocateEvent(_curTime, out num) || num < 0)
            {
                return;
            }
            int length = this.Length;

            if (_curTime >= length)
            {
                num = this.trackEvents.get_Count() - 1;
            }
            int num2 = num - 1;

            if (num2 < 0)
            {
                num2 = 0;
            }
            int num3 = num + 1;

            if (num3 >= this.trackEvents.get_Count())
            {
                num3 = num;
            }
            if (this.isDurationEvent)
            {
                for (int i = num2; i < this.trackEvents.get_Count(); i++)
                {
                    DurationEvent durationEvent = this.trackEvents.get_Item(i) as DurationEvent;
                    if (this.CheckSkip(_curTime, durationEvent.Start) && durationEvent.CheckConditions(this.action))
                    {
                        if (this.activeEvents.get_Count() == 0)
                        {
                            durationEvent.Enter(this.action, this);
                        }
                        else
                        {
                            DurationEvent durationEvent2 = this.activeEvents.get_Item(0);
                            int           blendTime      = durationEvent2.End - durationEvent.Start;
                            durationEvent.EnterBlend(this.action, this, durationEvent2, blendTime);
                        }
                        this.activeEvents.Add(durationEvent);
                    }
                    if (this.CheckSkip(_curTime, durationEvent.End) && this.activeEvents.Contains(durationEvent))
                    {
                        if (this.activeEvents.get_Count() > 1)
                        {
                            DurationEvent durationEvent3 = this.activeEvents.get_Item(1);
                            int           blendTime2     = durationEvent.End - durationEvent3.Start;
                            durationEvent.LeaveBlend(this.action, this, durationEvent3, blendTime2);
                        }
                        else
                        {
                            durationEvent.Leave(this.action, this);
                        }
                        this.activeEvents.Remove(durationEvent);
                    }
                }
            }
            else
            {
                for (int j = num2; j < this.trackEvents.get_Count(); j++)
                {
                    TickEvent tickEvent = this.trackEvents.get_Item(j) as TickEvent;
                    if (this.CheckSkip(_curTime, tickEvent.time) && tickEvent.CheckConditions(this.action))
                    {
                        tickEvent.Process(this.action, this);
                    }
                }
                if (num != num3)
                {
                    TickEvent tickEvent2  = this.trackEvents.get_Item(num) as TickEvent;
                    TickEvent tickEvent3  = this.trackEvents.get_Item(num3) as TickEvent;
                    float     blendWeight = (float)(_curTime - tickEvent2.time) / (float)(tickEvent3.time - tickEvent2.time);
                    tickEvent3.ProcessBlend(this.action, this, tickEvent2, blendWeight);
                }
                else
                {
                    TickEvent tickEvent4 = this.trackEvents.get_Item(num) as TickEvent;
                    int       localTime  = _curTime - tickEvent4.time;
                    tickEvent4.PostProcess(this.action, this, localTime);
                }
            }
            if (this.activeEvents.get_Count() == 1)
            {
                DurationEvent durationEvent4 = this.activeEvents.get_Item(0);
                int           localTime2;
                if (_curTime >= durationEvent4.Start)
                {
                    localTime2 = _curTime - durationEvent4.Start;
                }
                else
                {
                    localTime2 = _curTime + length - durationEvent4.Start;
                }
                durationEvent4.Process(this.action, this, localTime2);
            }
            else if (this.activeEvents.get_Count() == 2)
            {
                DurationEvent durationEvent5 = this.activeEvents.get_Item(0);
                DurationEvent durationEvent6 = this.activeEvents.get_Item(1);
                if (durationEvent5.Start < durationEvent6.Start && durationEvent5.End < length)
                {
                    int   localTime3    = _curTime - durationEvent6.Start;
                    int   prevLocalTime = _curTime - durationEvent5.Start;
                    float blendWeight2  = (float)(_curTime - durationEvent6.Start) / (float)(durationEvent5.End - durationEvent6.Start);
                    durationEvent6.ProcessBlend(this.action, this, localTime3, durationEvent5, prevLocalTime, blendWeight2);
                }
                else if (durationEvent5.Start < durationEvent6.Start && durationEvent5.End >= length)
                {
                    if (_curTime >= durationEvent6.Start)
                    {
                        int   localTime4     = _curTime - durationEvent6.Start;
                        int   prevLocalTime2 = _curTime - durationEvent5.Start;
                        float blendWeight3   = (float)(_curTime - durationEvent6.Start) / (float)(durationEvent5.End - durationEvent6.Start);
                        durationEvent6.ProcessBlend(this.action, this, localTime4, durationEvent5, prevLocalTime2, blendWeight3);
                    }
                    else
                    {
                        int   localTime5     = _curTime + length - durationEvent6.Start;
                        int   prevLocalTime3 = _curTime + length - durationEvent5.Start;
                        float blendWeight4   = (float)(_curTime + length - durationEvent6.Start) / (float)(durationEvent5.End - durationEvent6.Start);
                        durationEvent6.ProcessBlend(this.action, this, localTime5, durationEvent5, prevLocalTime3, blendWeight4);
                    }
                }
                else
                {
                    int   localTime6     = _curTime - durationEvent6.Start;
                    int   prevLocalTime4 = _curTime + length - durationEvent5.Start;
                    float blendWeight5   = (float)(_curTime - durationEvent6.Start) / (float)(durationEvent5.End - length - durationEvent6.Start);
                    durationEvent6.ProcessBlend(this.action, this, localTime6, durationEvent5, prevLocalTime4, blendWeight5);
                }
            }
        }
Ejemplo n.º 8
0
        public void CubicVectorBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight, bool isPos)
        {
            Vector3 vector5;
            Vector3 vector6;
            int     indexOfEvent = _track.GetIndexOfEvent(_prevEvent);
            int     num2         = _track.GetIndexOfEvent(this);
            int     eventsCount  = _track.GetEventsCount();
            int     index        = indexOfEvent - 1;

            if (index < 0)
            {
                if (_action.loop)
                {
                    index = eventsCount - 1;
                    if (index < 0)
                    {
                        index = 0;
                    }
                }
                else
                {
                    index = 0;
                }
            }
            int num5 = num2 + 1;

            if (num5 >= eventsCount)
            {
                if (_action.loop)
                {
                    num5 = 0;
                }
                else
                {
                    num5 = num2;
                }
            }
            ModifyTransform transform  = _prevEvent as ModifyTransform;
            ModifyTransform transform2 = _track.GetEvent(index) as ModifyTransform;
            ModifyTransform transform3 = _track.GetEvent(num5) as ModifyTransform;

            DebugHelper.Assert(((transform != null) && (transform2 != null)) && (transform3 != null), "��һ�Ѷ���Ӧ��Ϊ��");
            Vector3 prevPoint = !isPos ? transform.scaling : transform.GetTranslation(_action);
            Vector3 curnPoint = !isPos ? this.scaling : this.GetTranslation(_action);
            Vector3 formPoint = !isPos ? transform2.scaling : transform2.GetTranslation(_action);
            Vector3 lattPoint = !isPos ? transform3.scaling : transform3.GetTranslation(_action);

            CurvlData.CalculateCtrlPoint(formPoint, prevPoint, curnPoint, lattPoint, out vector5, out vector6);
            float   num6    = 1f - _blendWeight;
            float   num7    = _blendWeight;
            Vector3 vector7 = (Vector3)((((((prevPoint * num6) * num6) * num6) + ((((vector5 * 3f) * num6) * num6) * num7)) + ((((vector6 * 3f) * num6) * num7) * num7)) + (((curnPoint * num7) * num7) * num7));

            if (isPos)
            {
                _action.GetGameObject(this.targetId).transform.position = vector7;
            }
            else
            {
                _action.GetGameObject(this.targetId).transform.localScale = vector7;
            }
        }
Ejemplo n.º 9
0
 public virtual void ProcessBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight)
 {
 }
Ejemplo n.º 10
0
        public void Process(int _curTime)
        {
            this.preExcuteTime = this.curTime;
            this.curTime       = _curTime;
            int num = 0;

            if (this.LocateEvent(_curTime, out num) && (num >= 0))
            {
                int length = this.Length;
                if ((_curTime >= length) && !this.Loop)
                {
                    num = this.trackEvents.Count - 1;
                }
                if (this.Loop)
                {
                    int num3 = ((num - 1) + this.trackEvents.Count) % this.trackEvents.Count;
                    int num4 = ((num + 1) + this.trackEvents.Count) % this.trackEvents.Count;
                    if (this.isDurationEvent)
                    {
                        int num5 = num3;
                        for (int i = 0; i < this.trackEvents.Count; i++)
                        {
                            DurationEvent item = this.trackEvents[num5] as DurationEvent;
                            if (this.CheckSkip(_curTime, item.Start) && item.CheckConditions(this.action))
                            {
                                if (this.activeEvents.Count == 0)
                                {
                                    item.Enter(this.action, this);
                                }
                                else
                                {
                                    DurationEvent event3 = this.activeEvents[0];
                                    if ((event3.Start < item.Start) && (event3.End < length))
                                    {
                                        int num7 = event3.End - item.Start;
                                        item.EnterBlend(this.action, this, event3, num7);
                                    }
                                    else if ((event3.Start < item.Start) && (event3.End >= length))
                                    {
                                        int num8 = event3.End - item.Start;
                                        item.EnterBlend(this.action, this, event3, num8);
                                    }
                                    else
                                    {
                                        int num9 = (event3.End - length) - item.Start;
                                        item.EnterBlend(this.action, this, event3, num9);
                                    }
                                }
                                this.activeEvents.Add(item);
                            }
                            if (this.CheckSkip(_curTime, item.End) && this.activeEvents.Contains(item))
                            {
                                item.Leave(this.action, this);
                                this.activeEvents.Remove(item);
                            }
                            num5 = (num5 + 1) % this.trackEvents.Count;
                        }
                    }
                    else
                    {
                        int num10 = num3;
                        for (int j = 0; j < this.trackEvents.Count; j++)
                        {
                            TickEvent event4 = this.trackEvents[num10] as TickEvent;
                            if (this.CheckSkip(_curTime, event4.time) && event4.CheckConditions(this.action))
                            {
                                event4.Process(this.action, this);
                            }
                            num10 = (num10 + 1) % this.trackEvents.Count;
                        }
                        if (num != num4)
                        {
                            TickEvent event5 = this.trackEvents[num] as TickEvent;
                            TickEvent event6 = this.trackEvents[num4] as TickEvent;
                            if (event6.time > event5.time)
                            {
                                float num12 = ((float)(_curTime - event5.time)) / ((float)(event6.time - event5.time));
                                event6.ProcessBlend(this.action, this, event5, num12);
                            }
                            else if (event6.time < event5.time)
                            {
                                if (_curTime >= event5.time)
                                {
                                    float num13 = ((float)(_curTime - event5.time)) / ((float)((event6.time + length) - event5.time));
                                    event6.ProcessBlend(this.action, this, event5, num13);
                                }
                                else
                                {
                                    float num14 = ((float)((_curTime + length) - event5.time)) / ((float)((event6.time + length) - event5.time));
                                    event6.ProcessBlend(this.action, this, event5, num14);
                                }
                            }
                        }
                        else
                        {
                            TickEvent event7 = this.trackEvents[num] as TickEvent;
                            if (_curTime > event7.time)
                            {
                                int num15 = _curTime - event7.time;
                                event7.PostProcess(this.action, this, num15);
                            }
                            else if (_curTime < event7.time)
                            {
                                if (_curTime >= event7.time)
                                {
                                    int num16 = _curTime - event7.time;
                                    event7.PostProcess(this.action, this, num16);
                                }
                                else
                                {
                                    int num17 = (_curTime + length) - event7.time;
                                    event7.PostProcess(this.action, this, num17);
                                }
                            }
                        }
                    }
                }
                else
                {
                    int num18 = num - 1;
                    if (num18 < 0)
                    {
                        num18 = 0;
                    }
                    int num19 = num + 1;
                    if (num19 >= this.trackEvents.Count)
                    {
                        num19 = num;
                    }
                    if (this.isDurationEvent)
                    {
                        for (int k = num18; k < this.trackEvents.Count; k++)
                        {
                            DurationEvent event8 = this.trackEvents[k] as DurationEvent;
                            if (this.CheckSkip(_curTime, event8.Start) && event8.CheckConditions(this.action))
                            {
                                if (this.activeEvents.Count == 0)
                                {
                                    event8.Enter(this.action, this);
                                }
                                else
                                {
                                    DurationEvent event9 = this.activeEvents[0];
                                    int           num21  = event9.End - event8.Start;
                                    event8.EnterBlend(this.action, this, event9, num21);
                                }
                                this.activeEvents.Add(event8);
                            }
                            if (this.CheckSkip(_curTime, event8.End) && this.activeEvents.Contains(event8))
                            {
                                if (this.activeEvents.Count > 1)
                                {
                                    DurationEvent event10 = this.activeEvents[1];
                                    int           num22   = event8.End - event10.Start;
                                    event8.LeaveBlend(this.action, this, event10, num22);
                                }
                                else
                                {
                                    event8.Leave(this.action, this);
                                }
                                this.activeEvents.Remove(event8);
                            }
                        }
                    }
                    else
                    {
                        for (int m = num18; m < this.trackEvents.Count; m++)
                        {
                            TickEvent event11 = this.trackEvents[m] as TickEvent;
                            if (this.CheckSkip(_curTime, event11.time) && event11.CheckConditions(this.action))
                            {
                                event11.Process(this.action, this);
                            }
                        }
                        if (num != num19)
                        {
                            TickEvent event12 = this.trackEvents[num] as TickEvent;
                            TickEvent event13 = this.trackEvents[num19] as TickEvent;
                            float     num24   = ((float)(_curTime - event12.time)) / ((float)(event13.time - event12.time));
                            event13.ProcessBlend(this.action, this, event12, num24);
                        }
                        else
                        {
                            TickEvent event14 = this.trackEvents[num] as TickEvent;
                            int       num25   = _curTime - event14.time;
                            event14.PostProcess(this.action, this, num25);
                        }
                    }
                }
                if (this.activeEvents.Count == 1)
                {
                    DurationEvent event15 = this.activeEvents[0];
                    int           num26   = 0;
                    if (_curTime >= event15.Start)
                    {
                        num26 = _curTime - event15.Start;
                    }
                    else
                    {
                        num26 = (_curTime + length) - event15.Start;
                    }
                    event15.Process(this.action, this, num26);
                }
                else if (this.activeEvents.Count == 2)
                {
                    DurationEvent event16 = this.activeEvents[0];
                    DurationEvent event17 = this.activeEvents[1];
                    if ((event16.Start < event17.Start) && (event16.End < length))
                    {
                        int   num27 = _curTime - event17.Start;
                        int   num28 = _curTime - event16.Start;
                        float num29 = ((float)(_curTime - event17.Start)) / ((float)(event16.End - event17.Start));
                        event17.ProcessBlend(this.action, this, num27, event16, num28, num29);
                    }
                    else if ((event16.Start < event17.Start) && (event16.End >= length))
                    {
                        if (_curTime >= event17.Start)
                        {
                            int   num30 = _curTime - event17.Start;
                            int   num31 = _curTime - event16.Start;
                            float num32 = ((float)(_curTime - event17.Start)) / ((float)(event16.End - event17.Start));
                            event17.ProcessBlend(this.action, this, num30, event16, num31, num32);
                        }
                        else
                        {
                            int   num33 = (_curTime + length) - event17.Start;
                            int   num34 = (_curTime + length) - event16.Start;
                            float num35 = ((float)((_curTime + length) - event17.Start)) / ((float)(event16.End - event17.Start));
                            event17.ProcessBlend(this.action, this, num33, event16, num34, num35);
                        }
                    }
                    else
                    {
                        int   num36 = _curTime - event17.Start;
                        int   num37 = (_curTime + length) - event16.Start;
                        float num38 = ((float)(_curTime - event17.Start)) / ((float)((event16.End - length) - event17.Start));
                        event17.ProcessBlend(this.action, this, num36, event16, num37, num38);
                    }
                }
            }
        }