예제 #1
0
        public void Update(GameTime gameTime)
        {
            if (Active == false)
            {
                return;
            }

            elapsedTime += (int)gameTime.ElapsedGameTime.TotalMilliseconds;

            if (elapsedTime > frameTime)
            {
                currentFrame++;
                if (currentFrame == frameCount)
                {
                    currentFrame = 0;
                    if (Looping == false)
                    {
                        Active = false;
                    }
                }

                elapsedTime = 0;
            }

            sourceRect      = size.ToRectangle(currentFrame * size.W, 0);
            destinationRect = new Rectangle((int)Position.X - (int)(size.W * scale) / 2,
                                            (int)Position.Y - (int)(size.H * scale) / 2,
                                            (int)(size.W * scale),
                                            (int)(size.H * scale)
                                            );
        }
예제 #2
0
 public Rectangle GetRect() => Sz.ToRectangle(DrawPosition);