예제 #1
0
        /// <summary>
        /// When overridden in the derived class, handles drawing to the map after the given <see cref="MapRenderLayer"/> is drawn.
        /// </summary>
        /// <param name="map">The map the drawing is taking place on.</param>
        /// <param name="e">The <see cref="NetGore.Graphics.DrawableMapDrawLayerEventArgs"/> instance containing the event data.</param>
        protected override void HandleDrawAfterLayer(IDrawableMap map, DrawableMapDrawLayerEventArgs e)
        {
            if (e.Layer != MapRenderLayer.SpriteForeground)
            {
                return;
            }

            // Get the visible area
            var visibleArea = e.Camera.GetViewArea();

            // Get and draw all entities, skipping those that we will never draw () and those that
            // we will always draw (_alwaysDrawTypes)
            var toDraw = map.Spatial.GetMany <Entity>(visibleArea, GetEntitiesToDrawFilter);

            // Add the entities we will always draw
            toDraw = toDraw.Concat(map.Spatial.GetMany <Entity>(GetEntitiesToAlwaysDrawFilter));

            // Draw
            foreach (var entity in toDraw)
            {
                EntityDrawer.Draw(e.SpriteBatch, e.Camera, entity);
            }
        }