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


C# Camera2D.IsVisible方法代码示例

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


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

示例1: Draw

        public void Draw(Camera2D camera, List<Tileset> tilesets)
        {
            var destination = new Rectangle(0, 0, Engine.TileWidth, Engine.TileHeight);

            // TODO: Replace this drawcall with a single drawcall to render all grass tiles
            for (int y = 0; y < Height; y++)
            {
                destination.Y = y * Engine.TileHeight + (int)Engine.Origin.Y;

                for (int x = 0; x < Width; x++)
                {
                    Tile tile = GetTile(x, y);

                    if (tile.TileIndex == -1 || tile.Tileset == -1)
                        continue;

                    destination.X = x * Engine.TileWidth + (int)Engine.Origin.X;

                    var position = new Vector2(destination.X, destination.Y);
                    if (camera.IsVisible(position))
                    {
                        FinalBomber.Instance.SpriteBatch.Draw(
                            tilesets[tile.Tileset].Texture,
                            destination,
                            tilesets[tile.Tileset].SourceRectangles[tile.TileIndex],
                            Color.White);
                    }
                }
            }
        }
开发者ID:Noxalus,项目名称:Final-Bomber,代码行数:30,代码来源:MapLayer.cs

示例2: Draw

        public void Draw(GameTime gameTime, Camera2D camera)
        {
            if (!camera.IsVisible(Position))
                return;

            Sprite.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);

            if (_itemDestroyAnimation.IsAnimating)
                _itemDestroyAnimation.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);
        }
开发者ID:Noxalus,项目名称:Final-Bomber,代码行数:10,代码来源:PowerUp.cs

示例3: Draw

 public void Draw(GameTime gameTime, Camera2D camera)
 {
     if (camera.IsVisible(Position))
         Sprite.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);
 }
开发者ID:Noxalus,项目名称:Final-Bomber,代码行数:5,代码来源:Arrow.cs

示例4: Draw

        public void Draw(GameTime gameTime, Camera2D camera)
        {
            if (!camera.IsVisible(Position))
                return;

            if (InDestruction)
            {
                if (_explosionAnimationsDirection.Count == 0)
                {
                    foreach (Point p in ActionField)
                    {
                        // Is this a wall ? => we don't like wall !
                        if (!CollisionLayer[p.X, p.Y] || p == CellPosition)
                        {
                            // We choose the sprite of explosion for each cell
                            _explosionAnimationsDirection[p] = ComputeExplosionSpriteDirections(p);
                        }
                    }
                }
                else
                {
                    foreach (Point p in _explosionAnimationsDirection.Keys)
                    {
                        FinalBomber.Instance.SpriteBatch.Draw(_explosionSpriteTexture,
                            new Vector2(Engine.Origin.X + p.X * Engine.TileWidth, Engine.Origin.Y + p.Y * Engine.TileHeight),
                            _explosionAnimations[(int)_explosionAnimationsDirection[p]].CurrentFrameRect, Color.White);
                    }
                }
            }
            else
                Sprite.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);
        }
开发者ID:Noxalus,项目名称:Final-Bomber,代码行数:32,代码来源:Bomb.cs


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