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;
            }
        }
示例#2
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;
            }
        }