Example #1
0
 private int GetAnimationKey(Motion2 motion, MotionState motionState)
 {
     return((int)motionState.PreviousCardinalRotation.Degrees
            + (motion.Velocity.IsMoving()
                ? (int)Moving.Yes
                : (int)Moving.No));
 }
Example #2
0
        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]);
        }