private AnimationData GetAnimationData(int frameHeight, int frameWidth, int totalXFrames, int totalYFrames, float frameTime, String spriteDir, GraphicsEnum graphicsEnum)
 {
     var animationData = new AnimationData();
     animationData.FrameHeight = frameHeight;
     animationData.FrameWidth = frameWidth;
     animationData.TotalXFrames = totalXFrames;
     animationData.TotalYFrames = totalYFrames;
     animationData.FrameTime = frameTime;
     animationData.GraphicsEnum = graphicsEnum;
     animationData.SpriteSheet = _content.Load<Texture2D>(spriteDir + graphicsEnum);
     return animationData;
 }
Beispiel #2
0
        private void updateAnimations(AnimationData animation)
        {
            while (_time > animation.FrameTime)
            {
                // Play the next frame in the SpriteSheet
                _frameIndexX++;

                // reset elapsedTIme
                _time = 0f;
            }

            ManageFrameIndexes();
        }
Beispiel #3
0
 private void DrawTamogochiAnimation(AnimationData animation)
 {
     var origin = new Vector2(animation.FrameWidth / 2.0f, animation.FrameHeight + 128);
     _spriteBatch.Draw(animation.SpriteSheet, position, animation.GetSourceRectangle(_frameIndexX, _frameIndexY), Color.White, 0.0f, origin, 1.0f, SpriteEffects.None, 0.0f);
 }