コード例 #1
0
        public void shiftTo(Motions motions, int motionId, bool isLoop)
        // 次のモーションにただちに遷移させる。
        // 次のモーションは最初のフレームがタイムゼロならカットする。
        {
            var stream = motions[motionId].getStream(streamId, enKeyMode);

            var nextKeyOffset = stream.times[0] == 0.0f ? 1 : 0;

            to = stream.getKeyLimitedMax(motionId, 0 + nextKeyOffset);

            next = stream.getKeyLimitedMax(motionId, 1 + nextKeyOffset);


            timeRate = to.time != from.time ? 1.0f / (to.time - from.time) : 0.0f;
        }
コード例 #2
0
        public void progress(float time, Motions motions, bool isLoop)
        {
            while (time > to.time)
            {
                prev = from;
                from = to;
                to   = next;

                if (to.keyCount > 0)
                {
                    // 次のキーへ

                    var stream = motions[to.motionId].getStream(streamId, enKeyMode);

                    next = stream.getKeyNextCount(to.motionId, to.keyCount);

                    timeRate = to.time != from.time ? 1.0f / (to.time - from.time) : 0.0f;
                }
                else if (isLoop)
                {
                    // 先頭キーへ

                    time -= from.time;

                    var stream = motions[to.motionId].getStream(streamId, enKeyMode);

                    var nextKeyOffset = stream.times[0] == 0.0f ? 1 : 0;

                    next = stream.getKeyLimitedMax(to.motionId, 0 + nextKeyOffset);

                    timeRate = to.time != from.time ? 1.0f / to.time : 0.0f;
                }
                else
                {
                    // 最後のキーがずっと続く

                    to.time = float.PositiveInfinity;
                }

                //if( streamId == 1 ) Debug.Log( streamId + " " + prev.keyCount + " " + from.keyCount + " " + to.keyCount + " " + next.keyCount );
            }
        }
コード例 #3
0
        public void set(Motions motions, int motionId, bool isLoop)
        {
            var stream = motions[motionId].getStream(streamId, enKeyMode);

            prev     =
                from = stream.getKey(motionId, 0);

            if (isLoop)
            {
                to = stream.getKeyLimitedMax(motionId, 1);                  //

                next = stream.getKeyLimitedMax(motionId, 2);                //
            }
            else
            {
                to = stream.getKeyLimitedMax(motionId, 1);

                next = stream.getKeyLimitedMax(motionId, 2);
            }


            timeRate = to.time != from.time ? 1.0f / (to.time - from.time) : 0.0f;
        }