当前位置: 首页>>代码示例>>C#>>正文


C# Map.CenterOfCell方法代码示例

本文整理汇总了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;
        }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:15,代码来源:Viewport.cs

示例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;
        }
开发者ID:zombie-einstein,项目名称:OpenRA,代码行数:16,代码来源:Viewport.cs

示例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);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:14,代码来源:Shroud.cs

示例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);
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:20,代码来源:TerrainRenderer.cs

示例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;
        }
开发者ID:zombie-einstein,项目名称:OpenRA,代码行数:10,代码来源:Shroud.cs

示例6: ProjectedCellsInRange

 public static IEnumerable<PPos> ProjectedCellsInRange(Map map, CPos cell, WDist range, int maxHeightDelta = -1)
 {
     return ProjectedCellsInRange(map, map.CenterOfCell(cell), range, maxHeightDelta);
 }
开发者ID:pchote,项目名称:OpenRA,代码行数:4,代码来源:Shroud.cs


注:本文中的Map.CenterOfCell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。