Ejemplo n.º 1
0
        /// <summary>
        /// Gets the animation frame index for a given animation type and the
        /// total animation ticks of the animation.
        ///
        /// If the animation is over or there are no frames at all this
        /// method will return null to state that there is no frame.
        /// </summary>
        public int?GetAnimationFrameIndex(MonsterAnimationType animationType, uint animationTicks, uint ticksPerFrame)
        {
            var animation = Animations[(int)animationType];

            if (animation.UsedAmount == 0)
            {
                return(null);
            }

            uint frameIndex = animationTicks / ticksPerFrame;

            if (frameIndex >= animation.UsedAmount)
            {
                return(null);
            }

            return(animation.FrameIndices[frameIndex]);
        }
Ejemplo n.º 2
0
        public int[] GetAnimationFrameIndices(MonsterAnimationType animationType)
        {
            var animation = Animations[(int)animationType];

            return(animation.FrameIndices.Take(animation.UsedAmount).Select(b => (int)b).ToArray());
        }
Ejemplo n.º 3
0
 public int GetAnimationFrameCount(MonsterAnimationType animationType) => Animations[(int)animationType].UsedAmount;