Example #1
0
        public void Draw(SpriteBatch spr)
        {
            int   width  = Map.Width;
            int   height = Map.Height;
            byte  lastID = 0;
            Shrub s      = null;

            var bounds = Map.TileDrawBounds;

            Logger.Log(bounds.X + ", " + bounds.Right);

            for (int x = bounds.X; x < bounds.Right; x++)
            {
                for (int y = bounds.Y; y < bounds.Bottom; y++)
                {
                    int  index = x + y * width;
                    byte id    = IDs[index];

                    if (id != 0)
                    {
                        if (lastID != id)
                        {
                            lastID = id;
                            s      = Shrub.Get(id);
                        }

                        if (s != null)
                        {
                            var colour = s.GetColour(x, y, Map);
                            var source = s.TextureBounds;
                            var dest   = new Rectangle(x * 16, y * 16 - (source.Height - 16), source.Width, source.Height);

                            spr.Draw(ShrubTexture, dest, source, colour, 0f, Vector2.Zero, SpriteEffects.None, Map.GetDepth(y * 16, DepthBias.SHRUBBERY));
                        }
                    }
                }
            }
        }
Example #2
0
 public Shrub GetShrub(int x, int y)
 {
     return(Shrub.Get(GetShrubID(x, y)));
 }