コード例 #1
0
        public void UpdateAnimationState()
        {
            float blendRatio = 0;

            if (ActualPlayer.IsInitialized && m_currentBlendTime > 0)
            {
                blendRatio = 1;
                if (m_totalBlendTime > 0)
                {
                    blendRatio = MathHelper.Clamp(m_currentBlendTime / m_totalBlendTime, 0, 1);
                }
            }
            if (ActualPlayer.IsInitialized)
            {
                if (m_state == AnimationBlendState.BlendOut)
                {
                    ActualPlayer.Weight = 1 - blendRatio;

                    if (blendRatio == 1)
                    {
                        ActualPlayer.Done();
                        m_state = AnimationBlendState.Stopped;
                    }
                }
                if (m_state == AnimationBlendState.BlendIn)
                {
                    if (m_totalBlendTime == 0)
                    {
                        blendRatio = 1;
                    }

                    ActualPlayer.Weight = blendRatio;

                    if (BlendPlayer.IsInitialized)
                    {
                        BlendPlayer.Weight = 1;
                    }

                    if (blendRatio == 1)
                    {
                        m_state = AnimationBlendState.Playing;
                        BlendPlayer.Done();
                    }
                }
            }
        }