Пример #1
0
    protected override void AddKeyFrame()
    {
        UnSelectedAllKeyFrameList ();
        AnimatorKeyFrame keyFrame = new AnimatorKeyFrame();
        keyFrame.animaionStateIdx = 0;
        keyFrame.animationStateName = GetAnimationStateNameByIndex(0);
        int hashCode = GetAnimationClipHashCodeByIndex(0);
        keyFrame.animationStateLength = GetAnimationClipLengthByHashCode(hashCode);
        keyFrame.animationStateStartPos = 0.0f;
        keyFrame.animationStateEndPos = keyFrame.animationStateLength;
        keyFrame.time = GetCurrTime();
        keyFrame.isSelected = true;

        gogoAnimator.animatorKeyFrameList.Add(keyFrame);
        base.AddKeyFrame();
    }
    protected override void AddKeyFrame()
    {
        UnSelectedAllKeyFrameList();
        AnimatorKeyFrame keyFrame = new AnimatorKeyFrame();

        keyFrame.animaionStateIdx   = 0;
        keyFrame.animationStateName = GetAnimationStateNameByIndex(0);
        int hashCode = GetAnimationClipHashCodeByIndex(0);

        keyFrame.animationStateLength   = GetAnimationClipLengthByHashCode(hashCode);
        keyFrame.animationStateStartPos = 0.0f;
        keyFrame.animationStateEndPos   = keyFrame.animationStateLength;
        keyFrame.time       = GetCurrTime();
        keyFrame.isSelected = true;

        gogoAnimator.animatorKeyFrameList.Add(keyFrame);
        base.AddKeyFrame();
    }
    void SplitAnimation()
    {
        List <AnimatorKeyFrame> keyFrameList = gogoAnimator.animatorKeyFrameList;

        int   currIdx  = -1;
        float currTime = GetCurrTime();

        for (int i = keyFrameList.Count - 1; i >= 0; i--)
        {
            if (currTime >= keyFrameList [i].time)
            {
                currIdx = i;
                break;
            }
        }

        if (currIdx != -1)
        {
            float endPos = (currTime - keyFrameList [currIdx].time) + keyFrameList [currIdx].animationStateStartPos;
            endPos = Mathf.Min(endPos, keyFrameList[currIdx].animationStateEndPos);

            UnSelectedAllKeyFrameList();
            AnimatorKeyFrame keyFrame = new AnimatorKeyFrame();
            keyFrame.animaionStateIdx       = keyFrameList [currIdx].animaionStateIdx;
            keyFrame.animationStateName     = GetAnimationStateNameByIndex(keyFrameList [currIdx].animaionStateIdx);
            keyFrame.animationStateLength   = keyFrameList [currIdx].animationStateLength;
            keyFrame.animationStateStartPos = endPos;
            keyFrame.animationStateEndPos   = keyFrameList [currIdx].animationStateEndPos;
            keyFrame.speed           = keyFrameList [currIdx].speed;
            keyFrame.isInterpolation = keyFrameList [currIdx].isInterpolation;
            keyFrame.sampleRate      = keyFrameList [currIdx].sampleRate;
            keyFrame.isLoop          = keyFrameList [currIdx].isLoop;
            keyFrame.time            = GetCurrTime();
            keyFrame.isSelected      = true;

            keyFrameList [currIdx].animationStateEndPos = endPos;

            gogoAnimator.animatorKeyFrameList.Add(keyFrame);
            base.AddKeyFrame();
        }
    }
Пример #4
0
    void SplitAnimation()
    {
        List<AnimatorKeyFrame> keyFrameList = gogoAnimator.animatorKeyFrameList;

        int currIdx = -1;
        float currTime = GetCurrTime ();
        for (int i = keyFrameList.Count - 1; i >= 0; i--)
        {
            if ( currTime >= keyFrameList [i].time)
            {
                currIdx = i;
                break;
            }
        }

        if (currIdx != -1)
        {
            float endPos = (currTime - keyFrameList [currIdx].time) + keyFrameList [currIdx].animationStateStartPos;
            endPos = Mathf.Min (endPos, keyFrameList[currIdx].animationStateEndPos);

            UnSelectedAllKeyFrameList ();
            AnimatorKeyFrame keyFrame = new AnimatorKeyFrame();
            keyFrame.animaionStateIdx = keyFrameList [currIdx].animaionStateIdx;
            keyFrame.animationStateName = GetAnimationStateNameByIndex(keyFrameList [currIdx].animaionStateIdx);
            keyFrame.animationStateLength = keyFrameList [currIdx].animationStateLength;
            keyFrame.animationStateStartPos = endPos;
            keyFrame.animationStateEndPos = keyFrameList [currIdx].animationStateEndPos;
            keyFrame.speed = keyFrameList [currIdx].speed;
            keyFrame.isInterpolation = keyFrameList [currIdx].isInterpolation;
            keyFrame.sampleRate = keyFrameList [currIdx].sampleRate;
            keyFrame.isLoop = keyFrameList [currIdx].isLoop;
            keyFrame.time = GetCurrTime();
            keyFrame.isSelected = true;

            keyFrameList [currIdx].animationStateEndPos = endPos;

            gogoAnimator.animatorKeyFrameList.Add(keyFrame);
            base.AddKeyFrame ();
        }
    }