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);
}