Пример #1
0
        public virtual void Draw(ExtendedSpriteBatch spriteBatch)
        {
            if (IsAnimated)
            {
                if (Animations.ContainsKey(CurrentAnimation))
                {
                    spriteBatch.Draw(Animations[CurrentAnimation].SpriteSheet, new Rectangle(X, Y, Animations[CurrentAnimation].FrameWidth, Animations[CurrentAnimation].FrameHeight), Animations[CurrentAnimation].FrameRectangle, Color.White, 0.0f, new Vector2(0, 0), GetSpriteEffect(), 0);
                }
            }
            else
            {
                spriteBatch.Draw(Sprite, new Rectangle(X, Y, Sprite.Width, Sprite.Height), Color.White);
            }

            if (DrawBoundingBox)
            {
                spriteBatch.DrawRectangle(GetBoundingBox(), Color.Red);
            }
        }
Пример #2
0
        public void Draw(ExtendedSpriteBatch spriteBatch, Light nearestLight)
        {
            if (Map.TileSet.Tiles.ContainsKey(Name))
            {
                Color tileColor = Color.White;

                if (Config.LIGHTS_ENABLED)
                {
                    tileColor = Color.Black;
                    if (nearestLight != null)
                        tileColor = nearestLight.GetColor(Center);
                }

                spriteBatch.Draw(Map.TileSet.TileSheet, GetRectangle(), Map.TileSet.GetTileRectangle(Name), tileColor);
            }
            else
            {
                spriteBatch.DrawRectangle(new Rectangle(X * Width, Y * Height, Width, Height), Color.White);
            }
        }