public void Stop(float blendTime) { if (m_state != AnimationBlendState.Stopped) { BlendPlayer.Done(); m_state = AnimationBlendState.BlendOut; m_currentBlendTime = 0; m_totalBlendTime = blendTime; } }
public void UpdateAnimation() { //Upper body blend float upperBlendRatio = 0; if (ActualPlayer.IsInitialized && m_currentBlendTime > 0) { upperBlendRatio = 1; if (m_totalBlendTime > 0) { upperBlendRatio = MathHelper.Clamp(m_currentBlendTime / m_totalBlendTime, 0, 1); } } if (ActualPlayer.IsInitialized) { if (m_state == AnimationBlendState.BlendOut) { ActualPlayer.Weight = 1 - upperBlendRatio; if (upperBlendRatio == 1) { ActualPlayer.Done(); m_state = AnimationBlendState.Stopped; } } if (m_state == AnimationBlendState.BlendIn) { ActualPlayer.Weight = upperBlendRatio; if (BlendPlayer.IsInitialized) { BlendPlayer.Weight = 1; } if (upperBlendRatio == 1) { m_state = AnimationBlendState.Playing; } } } }