Esempio n. 1
0
        public virtual void Draw(SpriteBatch spriteBatch, Vector2 mapOffset, float blockSize)
        {
            var texture = GameContent.GetTexture(TextureName);
            var scale   = blockSize / texture.Height * 2f;

            spriteBatch.Draw(texture, mapOffset + Position * blockSize, null, Color.White,
                             Convert.ToSingle(rotation), new Vector2(texture.Width, texture.Height) * 0.5f,
                             scale, SpriteEffects.None, 0.0f);
        }
Esempio n. 2
0
 public override void Draw(ContentManager contentManager, SpriteBatch spriteBatch, Rectangle screenSize)
 {
     base.Draw(contentManager, spriteBatch, screenSize);
     for (int x = 0; x < AREA_SIZE; x++)
     {
         for (int y = 0; y < AREA_SIZE; y++)
         {
             double blockSize   = screenSize.Height / Convert.ToDouble(AREA_SIZE);
             var    destination = new Rectangle(
                 Convert.ToInt32(MapOffset.X + x * blockSize),
                 Convert.ToInt32(y * blockSize),
                 Convert.ToInt32(blockSize + 1),
                 Convert.ToInt32(blockSize + 1));
             _terrain[x, y].Draw(spriteBatch, destination);
         }
     }
     _player.Draw(spriteBatch, MapOffset, BlockSize);
     foreach (var bullet in _bullets)
     {
         bullet.Draw(spriteBatch);
     }
     spriteBatch.Draw(GameContent.GetTexture("target"), new Vector2(mouseState.X, mouseState.Y), null,
                      Color.White, 0f, Vector2.One * 100f, 1.5f * BlockSize / 100f, SpriteEffects.None, 0f);
 }
Esempio n. 3
0
 public void Draw(SpriteBatch spriteBatch, Rectangle destination)
 {
     spriteBatch.Draw(GameContent.GetTexture("block_" + _terrainName), destination, Color.White);
 }
Esempio n. 4
0
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Draw(GameContent.GetTexture("bullet"), Position, null, Color.White, 0.0f,
                      new Vector2(16.0f, 16.0f), 0.3f, SpriteEffects.None, 0.0f);
 }