Ejemplo n.º 1
0
        public void Initialize(GraphicsDevice GraphicsDevice)
        {
            // fetch all Actions & build SpriteAnimations from it
            for (int a = 0; a < mRagnarokAnimation.Actions.Count; a++)
            {
                mAnimation[a] = new SpriteAnimation();
                for (int f = 0; f < mRagnarokAnimation.Actions[a].Frames.Count; f++)
                {
                    SpriteAnimationFrame frame = new SpriteAnimationFrame();
                    for (int i = 0; i < mRagnarokAnimation.Actions[a].Frames[f].Images.Count; i++)
                    {
                        RagnarokAnimationActionFrameImage roImg = mRagnarokAnimation.Actions[a].Frames[f].Images[i];
                        SpriteAnimationFrameImage         img   = new SpriteAnimationFrameImage();
                        img.Size     = new Point((int)(roImg.Width * roImg.ScaleX), (int)(roImg.Height * roImg.ScaleY));
                        img.Position = new Point(roImg.X, roImg.Y);
                        img.Rotation = roImg.Rotation;
                        img.Texture  = mRagnarokAnimation.Images[roImg.Number].BuildTexture2D(mRagnarokAnimation.Palette, GraphicsDevice);
                        img.Color    = Color.White;
                        img.Mirror   = (roImg.Mirror ? SpriteEffects.FlipHorizontally : SpriteEffects.None);


                        frame.Images.Add(img);
                    }

                    mAnimation[a].Frames.Add(frame);
                }
            }
        }
Ejemplo n.º 2
0
		public void Initialize( GraphicsDevice GraphicsDevice ) {
			// fetch all Actions & build SpriteAnimations from it
			for( int a = 0; a < mRagnarokAnimation.Actions.Count; a++ ) {
				mAnimation[ a ] = new SpriteAnimation();
				for( int f = 0; f < mRagnarokAnimation.Actions[ a ].Frames.Count; f++ ) {
					SpriteAnimationFrame frame = new SpriteAnimationFrame();
					for( int i = 0; i < mRagnarokAnimation.Actions[ a ].Frames[ f ].Images.Count; i++ ) {
						RagnarokAnimationActionFrameImage roImg = mRagnarokAnimation.Actions[ a ].Frames[ f ].Images[ i ];
						SpriteAnimationFrameImage img = new SpriteAnimationFrameImage();
						img.Size = new Point( (int)( roImg.Width * roImg.ScaleX ), (int)( roImg.Height * roImg.ScaleY ) );
						img.Position = new Point( roImg.X, roImg.Y );
						img.Rotation = roImg.Rotation;
						img.Texture = mRagnarokAnimation.Images[ roImg.Number ].BuildTexture2D( mRagnarokAnimation.Palette, GraphicsDevice );
						img.Color = Color.White;
						img.Mirror = ( roImg.Mirror ? SpriteEffects.FlipHorizontally : SpriteEffects.None );


						frame.Images.Add( img );
					}

					mAnimation[ a ].Frames.Add( frame );
				}
			}
		}