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


C# World.FindTilesInCircle方法代码示例

本文整理汇总了C#中World.FindTilesInCircle方法的典型用法代码示例。如果您正苦于以下问题:C# World.FindTilesInCircle方法的具体用法?C# World.FindTilesInCircle怎么用?C# World.FindTilesInCircle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在World的用法示例。


在下文中一共展示了World.FindTilesInCircle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

 public IEnumerable<IRenderable> Render(WorldRenderer wr, World world)
 {
     var xy = wr.Position(wr.Viewport.ViewToWorldPx(Viewport.LastMousePos)).ToCPos();
     var pal = wr.Palette("terrain");
     foreach (var t in world.FindTilesInCircle(xy, range))
         yield return new SpriteRenderable(tile, t.CenterPosition, WVec.Zero, -511, pal, 1f, true);
 }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:7,代码来源:IronCurtainPower.cs

示例2: Render

            public IEnumerable<IRenderable> Render(WorldRenderer wr, World world)
            {
                var xy = Game.viewport.ViewToWorld(Viewport.LastMousePos);
                var pal = wr.Palette("terrain");

                // Source tiles
                foreach (var t in world.FindTilesInCircle(sourceLocation, range))
                    yield return new SpriteRenderable(sourceTile, t.CenterPosition, WVec.Zero, -511, pal, 1f, true);

                // Destination tiles
                foreach (var t in world.FindTilesInCircle(xy, range))
                    yield return new SpriteRenderable(sourceTile, t.CenterPosition, WVec.Zero, -511, pal, 1f, true);

                // Unit previews
                foreach (var unit in power.UnitsInRange(sourceLocation))
                {
                    var offset = (xy - sourceLocation).ToWVec();
                    if (manager.self.Owner.Shroud.IsTargetable(unit))
                        foreach (var r in unit.Render(wr))
                            yield return r.OffsetBy(offset);
                }

                // Unit tiles
                foreach (var unit in power.UnitsInRange(sourceLocation))
                {
                    if (manager.self.Owner.Shroud.IsTargetable(unit))
                    {
                        var targetCell = unit.Location + (xy - sourceLocation);
                        var canEnter = ((manager.self.Owner.Shroud.IsExplored(targetCell) || manager.self.Owner.HasFogVisibility()) &&
                                        unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit,targetCell));
                        var tile = canEnter ? validTile : invalidTile;
                        yield return new SpriteRenderable(tile, targetCell.CenterPosition, WVec.Zero, -511, pal, 1f, true);
                    }
                }
            }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:35,代码来源:ChronoshiftPower.cs

示例3: RenderBeforeWorld

 public void RenderBeforeWorld(WorldRenderer wr, World world)
 {
     var xy = Game.viewport.ViewToWorld(Viewport.LastMousePos);
     foreach (var t in world.FindTilesInCircle(xy, range))
         tile.DrawAt( wr, t.ToPPos().ToFloat2(), "terrain" );
 }
开发者ID:JamesDunne,项目名称:OpenRA,代码行数:6,代码来源:IronCurtainPower.cs

示例4: RenderBeforeWorld

            public void RenderBeforeWorld(WorldRenderer wr, World world)
            {
                var xy = Game.viewport.ViewToWorld(Viewport.LastMousePos);

                // Source tiles
                foreach (var t in world.FindTilesInCircle(sourceLocation, range))
                    sourceTile.DrawAt( wr, t.ToPPos().ToFloat2(), "terrain" );

                // Destination tiles
                foreach (var t in world.FindTilesInCircle(xy, range))
                    sourceTile.DrawAt( wr, t.ToPPos().ToFloat2(), "terrain" );

                // Unit previews
                foreach (var unit in power.UnitsInRange(sourceLocation))
                {
                    if (manager.self.Owner.Shroud.IsTargetable(unit)) {
                        var targetCell = unit.Location + (xy - sourceLocation);
                        foreach (var r in unit.Render(wr))
                            r.Sprite.DrawAt(r.Pos - Traits.Util.CenterOfCell(unit.Location).ToFloat2() + Traits.Util.CenterOfCell(targetCell).ToFloat2(),
                                r.Palette.Index,
                                r.Scale*r.Sprite.size);
                    }
                }

                // Unit tiles
                foreach (var unit in power.UnitsInRange(sourceLocation))
                {
                    if (manager.self.Owner.Shroud.IsTargetable(unit)) {
                        var targetCell = unit.Location + (xy - sourceLocation);
                        var canEnter = ((manager.self.Owner.Shroud.IsExplored(targetCell) || manager.self.Owner.HasFogVisibility())&& unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit,targetCell));
                        var tile = canEnter ? validTile : invalidTile;
                        tile.DrawAt( wr, targetCell.ToPPos().ToFloat2(), "terrain" );
                    }
                }
            }
开发者ID:nevelis,项目名称:OpenRA,代码行数:35,代码来源:ChronoshiftPower.cs


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