/// <summary> /// When overridden in the derived class, handles drawing to the map after all of the map drawing finishes. /// </summary> /// <param name="map">The map the drawing is taking place on.</param> /// <param name="spriteBatch">The <see cref="ISpriteBatch"/> to draw to.</param> /// <param name="camera">The <see cref="ICamera2D"/> that describes the view of the map being drawn.</param> protected override void HandleDrawAfterMap(IDrawableMap map, ISpriteBatch spriteBatch, ICamera2D camera) { var p = Parent; if (p == null) { return; } // Ensure the map is valid var clientMap = map as EditorMap; if (clientMap == null) { return; } var viewArea = camera.GetViewArea(); // Draw the walls if (p.DrawWalls) { var visibleWalls = map.Spatial.GetMany <WallEntityBase>(viewArea); foreach (var wall in visibleWalls) { EntityDrawer.Draw(spriteBatch, camera, wall); } } // Draw the MapGrh walls if (p.DrawMapGrhWalls) { var mapGrhWalls = GlobalState.Instance.MapGrhWalls; var toDraw = clientMap.Spatial.GetMany <MapGrh>(viewArea); var tmpWall = new WallEntity(Vector2.Zero, Vector2.Zero); foreach (var mg in toDraw) { var boundWalls = mapGrhWalls[mg.Grh.GrhData]; if (boundWalls == null) { continue; } foreach (var wall in boundWalls) { tmpWall.Size = wall.Size != Vector2.Zero ? wall.Size * mg.Scale : mg.Size; tmpWall.Position = mg.Position + (wall.Position * mg.Scale); tmpWall.IsPlatform = wall.IsPlatform; EntityDrawer.Draw(spriteBatch, camera, tmpWall); } } } }
/// <summary> /// When overridden in the derived class, handles drawing to the map after all of the map drawing finishes. /// </summary> /// <param name="map">The map the drawing is taking place on.</param> /// <param name="spriteBatch">The <see cref="ISpriteBatch"/> to draw to.</param> /// <param name="camera">The <see cref="ICamera2D"/> that describes the view of the map being drawn.</param> protected override void HandleDrawAfterMap(IDrawableMap map, ISpriteBatch spriteBatch, ICamera2D camera) { var p = Parent; if (p == null) { return; } // Ensure the map is valid var clientMap = map as EditorMap; if (clientMap == null) { return; } var viewArea = camera.GetViewArea(); // Draw the walls if (p.DrawWalls) { var visibleWalls = map.Spatial.GetMany <WallEntityBase>(viewArea); foreach (var wall in visibleWalls) { EntityDrawer.Draw(spriteBatch, camera, wall); } } // Draw the MapGrh walls if (p.DrawMapGrhWalls) { var toDraw = clientMap.Spatial.GetMany <MapGrh>(viewArea); foreach (var mg in toDraw) { var boundWalls = GlobalState.Instance.MapGrhWalls[mg.Grh.GrhData]; if (boundWalls == null) { continue; } foreach (var wall in boundWalls) { EntityDrawer.Draw(spriteBatch, camera, wall, mg.Position); } } } }
/// <summary> /// When overridden in the derived class, handles drawing to the map after all of the map drawing finishes. /// </summary> /// <param name="map">The map the drawing is taking place on.</param> /// <param name="spriteBatch">The <see cref="ISpriteBatch"/> to draw to.</param> /// <param name="camera">The <see cref="ICamera2D"/> that describes the view of the map being drawn.</param> protected override void HandleDrawAfterMap(IDrawableMap map, ISpriteBatch spriteBatch, ICamera2D camera) { var p = Parent; if (p == null) return; // Ensure the map is valid var clientMap = map as EditorMap; if (clientMap == null) return; var viewArea = camera.GetViewArea(); // Draw the walls if (p.DrawWalls) { var visibleWalls = map.Spatial.GetMany<WallEntityBase>(viewArea); foreach (var wall in visibleWalls) { EntityDrawer.Draw(spriteBatch, camera, wall); } } // Draw the MapGrh walls if (p.DrawMapGrhWalls) { var mapGrhWalls = GlobalState.Instance.MapGrhWalls; var toDraw = clientMap.Spatial.GetMany<MapGrh>(viewArea); var tmpWall = new WallEntity(Vector2.Zero, Vector2.Zero); foreach (var mg in toDraw) { var boundWalls = mapGrhWalls[mg.Grh.GrhData]; if (boundWalls == null) continue; foreach (var wall in boundWalls) { tmpWall.Size = wall.Size != Vector2.Zero ? wall.Size * mg.Scale : mg.Size; tmpWall.Position = mg.Position + (wall.Position * mg.Scale); tmpWall.IsPlatform = wall.IsPlatform; EntityDrawer.Draw(spriteBatch, camera, tmpWall); } } } }
/// <summary> /// When overridden in the derived class, handles drawing to the map after all of the map drawing finishes. /// </summary> /// <param name="map">The map the drawing is taking place on.</param> /// <param name="spriteBatch">The <see cref="ISpriteBatch"/> to draw to.</param> /// <param name="camera">The <see cref="ICamera2D"/> that describes the view of the map being drawn.</param> protected override void HandleDrawAfterMap(IDrawableMap map, ISpriteBatch spriteBatch, ICamera2D camera) { var p = Parent; if (p == null) return; // Ensure the map is valid var clientMap = map as EditorMap; if (clientMap == null) return; var viewArea = camera.GetViewArea(); // Draw the walls if (p.DrawWalls) { var visibleWalls = map.Spatial.GetMany<WallEntityBase>(viewArea); foreach (var wall in visibleWalls) { EntityDrawer.Draw(spriteBatch, camera, wall); } } // Draw the MapGrh walls if (p.DrawMapGrhWalls) { var toDraw = clientMap.Spatial.GetMany<MapGrh>(viewArea); foreach (var mg in toDraw) { var boundWalls = GlobalState.Instance.MapGrhWalls[mg.Grh.GrhData]; if (boundWalls == null) continue; foreach (var wall in boundWalls) { EntityDrawer.Draw(spriteBatch, camera, wall, mg.Position); } } } }