/// <summary>
 /// Draw the GameObject at its isometric location
 /// </summary>
 public void DrawIsometric(GameTime gameTime, SpriteBatchIsometric spriteBatch)
 {
     spriteBatch.DrawIsometric(
         _texture,
         _parent.Displacement,
         _drawColor);
 }
Beispiel #2
0
        public void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // ---------- Draw all tiles ----------
            for (int i = 0; i < _numRows; i++)
                for (int j = 0; j < _numCols; j++)
                {
                    TileRef currTile = _tiles[i, j];

                    Vector3 tilePosition;
                    tilePosition.X = i * TILE_SIZE;
                    tilePosition.Y = currTile.Elevation * TILE_SIZE;
                    tilePosition.Z = j * TILE_SIZE;

                    spriteBatch.DrawIsometric(
                        TileTypes[currTile.ReferenceID].Texture,
                        tilePosition,
                        Color.White);
                }

            // ---------- Draw selection indicators ----------
            foreach (Vector2 index in _selectedIndices)
            {
                int x = (int)index.X;
                int y = (int)index.Y;
                TileRef currTile = _tiles[x, y];

                Vector3 drawPosition;
                drawPosition.X = x * TILE_SIZE;
                drawPosition.Y = currTile.Elevation * TILE_SIZE;
                drawPosition.Z = y * TILE_SIZE;

                spriteBatch.DrawIsometric(
                    _selectionTexture,
                    drawPosition,
                    Color.White);
            }
        }