本文整理汇总了C#中ICamera2D.GetViewArea方法的典型用法代码示例。如果您正苦于以下问题:C# ICamera2D.GetViewArea方法的具体用法?C# ICamera2D.GetViewArea怎么用?C# ICamera2D.GetViewArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICamera2D
的用法示例。
在下文中一共展示了ICamera2D.GetViewArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleDrawAfterMap
/// <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);
}
}
}
}
示例2: HandleDrawAfterMap
/// <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);
}
}
}
}