本文整理汇总了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);
}
}
}
}
示例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);
}
示例3: Draw
public void Draw(GameTime gameTime, Camera2D camera)
{
if (camera.IsVisible(Position))
Sprite.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);
}
示例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);
}