本文整理汇总了C#中Map.CenterOfCell方法的典型用法代码示例。如果您正苦于以下问题:C# Map.CenterOfCell方法的具体用法?C# Map.CenterOfCell怎么用?C# Map.CenterOfCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map.CenterOfCell方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Viewport
public Viewport(WorldRenderer wr, Map map)
{
worldRenderer = wr;
// Calculate map bounds in world-px
var b = map.Bounds;
// Expand to corners of cells
var tl = wr.ScreenPxPosition(map.CenterOfCell(Map.MapToCell(map.TileShape, new CPos(b.Left, b.Top))) - new WVec(512, 512, 0));
var br = wr.ScreenPxPosition(map.CenterOfCell(Map.MapToCell(map.TileShape, new CPos(b.Right, b.Bottom))) + new WVec(511, 511, 0));
mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
CenterLocation = (tl + br) / 2;
Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1;
}
示例2: Viewport
public Viewport(WorldRenderer wr, Map map)
{
worldRenderer = wr;
var cells = wr.World.Type == WorldType.Editor ?
map.AllCells : map.CellsInsideBounds;
// Calculate map bounds in world-px
var tl = wr.ScreenPxPosition(map.CenterOfCell(cells.TopLeft) - new WVec(512, 512, 0));
var br = wr.ScreenPxPosition(map.CenterOfCell(cells.BottomRight) + new WVec(511, 511, 0));
mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
CenterLocation = (tl + br) / 2;
Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1;
tileSize = Game.ModData.Manifest.TileSize;
}
示例3: ProjectedCellsInRange
public static IEnumerable<PPos> ProjectedCellsInRange(Map map, WPos pos, WDist range)
{
// Account for potential extra half-cell from odd-height terrain
var r = (range.Length + 1023 + 512) / 1024;
var limit = range.LengthSquared;
// Project actor position into the shroud plane
var projectedPos = pos - new WVec(0, pos.Z, pos.Z);
var projectedCell = map.CellContaining(projectedPos);
foreach (var c in map.FindTilesInCircle(projectedCell, r, true))
if ((map.CenterOfCell(c) - projectedPos).HorizontalLengthSquared <= limit)
yield return (PPos)c.ToMPos(map);
}
示例4: TerrainRenderer
public TerrainRenderer(World world, WorldRenderer wr)
{
this.world = world;
this.map = world.Map;
var terrainPalette = wr.Palette("terrain").Index;
var vertices = new Vertex[4 * map.Bounds.Height * map.Bounds.Width];
var nv = 0;
foreach (var cell in map.Cells)
{
var tile = wr.Theater.TileSprite(map.MapTiles.Value[cell]);
var pos = wr.ScreenPosition(map.CenterOfCell(cell)) - 0.5f * tile.size;
Util.FastCreateQuad(vertices, pos, tile, terrainPalette, nv, tile.size);
nv += 4;
}
vertexBuffer = Game.Renderer.Device.CreateVertexBuffer(vertices.Length);
vertexBuffer.SetData(vertices, nv);
}
示例5: CellsInRange
public static IEnumerable<CPos> CellsInRange(Map map, WPos pos, WDist range)
{
var r = (range.Length + 1023) / 1024;
var limit = range.LengthSquared;
var cell = map.CellContaining(pos);
foreach (var c in map.FindTilesInCircle(cell, r, true))
if ((map.CenterOfCell(c) - pos).HorizontalLengthSquared <= limit)
yield return c;
}
示例6: ProjectedCellsInRange
public static IEnumerable<PPos> ProjectedCellsInRange(Map map, CPos cell, WDist range, int maxHeightDelta = -1)
{
return ProjectedCellsInRange(map, map.CenterOfCell(cell), range, maxHeightDelta);
}