private int GetAnimationKey(Motion2 motion, MotionState motionState) { return((int)motionState.PreviousCardinalRotation.Degrees + (motion.Velocity.IsMoving() ? (int)Moving.Yes : (int)Moving.No)); }
private void EnsureCorrectAnimation(MotionAnimationStates motionStates, Motion2 motion, MotionState motionState, Animation animation) { var newKey = GetAnimationKey(motion, motionState); if (newKey == motionStates.CurrentAnimationKey) { return; } motionStates.CurrentAnimationKey = newKey; ReplaceAnimation(animation, motionStates.Animations[newKey]); }