Ejemplo n.º 1
0
        /// <summary>
        /// IMotionProviderメンバーの実装
        /// </summary>
        public void Tick(int fps, float elapsedTime, IMorphManager morphManager)
        {
            // 行列の更新
            foreach (var boneMotion in boneMotions)
            {
                boneMotion.ReviseBone((ulong)CurrentFrame);
            }
            foreach (var morphMotion in morphMotions)
            {
                morphManager.ApplyMorphProgress(morphMotion.GetMorphValue((ulong)CurrentFrame), morphMotion.MorphName);
            }

            // 停止中はフレームを進めない
            if (!isPlaying)
            {
                return;
            }

            // フレームを進める
            CurrentFrame += elapsedTime * fps;
            if (FrameTicked != null)
            {
                FrameTicked(this, new EventArgs());
            }

            // 最終フレームに達した時の処理
            if (CurrentFrame >= FinalFrame)
            {
                CurrentFrame = (actionAfterMotion == ActionAfterMotion.Replay) ? 1.0e-3f : FinalFrame;
                if (MotionFinished != null)
                {
                    MotionFinished(this, actionAfterMotion);
                }
            }
        }
Ejemplo n.º 2
0
        private bool SetMorphProgress(float progress, string morphName)
        {
            if (!Morphs.ContainsKey(morphName))
            {
                return(false);
            }
            GroupMorphData data = Morphs[morphName];

            foreach (GroupMorphOffset groupMorphOffset in data.MorphOffsets)
            {
                string targetMorph = morphNameList[groupMorphOffset.MorphIndex];
                if (morphName.Equals(targetMorph))
                {
                    throw new InvalidOperationException("グループモーフに自身のモーフが指定されています。");
                }
                morphManager.ApplyMorphProgress(progress * groupMorphOffset.MorphRatio, targetMorph);
            }
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// IMotionProviderImplementation of a Member
        /// </summary>
        public void Tick(int fps, float elapsedTime, IMorphManager morphManager)
        {
            // 行列の更新
            foreach (var boneMotion in this.boneMotions)
            {
                boneMotion.ReviseBone(this.CurrentFrame);
            }
            foreach (var morphMotion in this.morphMotions)
            {
                morphManager.ApplyMorphProgress(morphMotion.GetMorphValue((ulong)this.CurrentFrame), morphMotion.MorphName);
            }

            if (!this.isPlaying)
            {
                return;
            }
            this.CurrentFrame += (float)elapsedTime * fps;
            if (this.CurrentFrame >= this.FinalFrame)
            {
                this.CurrentFrame = this.FinalFrame;
            }
            if (FrameTicked != null)
            {
                FrameTicked(this, new EventArgs());
            }
            if (this.CurrentFrame >= this.FinalFrame)
            {
                if (MotionFinished != null)
                {
                    MotionFinished(this, this.actionAfterMotion);
                }
                if (this.actionAfterMotion == ActionAfterMotion.Replay)
                {
                    this.CurrentFrame = 1.0e-3f;
                }
            }
        }