示例#1
0
 /// <summary>
 /// Draw the GameObject at its isometric location
 /// </summary>
 public void DrawIsometric(GameTime gameTime, SpriteBatchIsometric spriteBatch)
 {
     spriteBatch.DrawIsometric(
         _texture,
         _parent.Displacement,
         _drawColor);
 }
        /// <summary>
        /// Draw this layer
        /// </summary>
        public override void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // ---------- Begin drawing from this layer's perspective ----------
            spriteBatch.Begin(
                SpriteSortMode.Deferred,
                BlendState.AlphaBlend,
                null,
                null,
                null,
                null,
                _camTransformation);

            // ---------- Draw TileSystem ----------
            _tileSystem.Draw(gameTime, spriteBatch);

            // ---------- Draw GameObjects ----------
            foreach (GameObject go in _gameObjects)
            {
                GOCDrawable drawableComponent = go.GetComponent<GOCDrawable>();
                if (drawableComponent != null)
                    drawableComponent.Draw(gameTime, spriteBatch);
            }

            // ---------- Drawing complete ----------
            spriteBatch.End();
        }
示例#3
0
        /// <summary>
        /// Draw all data on this GameLayer
        /// </summary>
        public virtual void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // Begin drawing from this GameLayer's perspective
            spriteBatch.Begin(
                SpriteSortMode.Deferred,
                BlendState.AlphaBlend,
                null,
                null,
                null,
                null,
                _camTransformation);

            // ---------- Start drawing GameObjects ----------

            foreach (GameObject go in _gameObjects)
            {
                GOCDrawable drawableComponent = go.GetComponent<GOCDrawable>();
                if (drawableComponent != null)
                    drawableComponent.Draw(gameTime, spriteBatch);
            }

            // ---------- End drawing GameObjects ----------

            // End drawing
            spriteBatch.End();
        }
示例#4
0
        /// <summary>
        /// Draw the GameObject at its cartesian location
        /// </summary>
        public void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            Vector2 position;
            position.X = _parent.Displacement.X;
            position.Y = _parent.Displacement.Z;

            spriteBatch.Draw(
                _texture,
                position,
                _drawColor);
        }
示例#5
0
        /// <summary>
        /// Draw everything contained in the GameScreen
        /// </summary>
        public override void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // ---------- Draw GameLevel ----------
            _gameLevel.Draw(gameTime, spriteBatch);

            // ---------- Draw GameInterface ----------
            _gameInterface.Draw(gameTime, spriteBatch);

            // ---------- Draw Base ----------
            base.Draw(gameTime, spriteBatch);
        }
示例#6
0
 /// <summary>
 /// Draw this GameLevel
 /// </summary>
 public void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
 {
     // Draw the main layer
     _mainLayer.Draw(gameTime, spriteBatch);
 }
示例#7
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 ----------
            if (_selectedIndices.Count != 0)
            {
                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(
                        _selectionTextureDraw,
                        drawPosition,
                        _selectionColorDraw);
                }
            }
            else
            {
                if (VerifyIndexWithinRange(_currentMouseTileIndex))
                {
                    TileRef mouseTile = _tiles[(int)_currentMouseTileIndex.X, (int)_currentMouseTileIndex.Y];
                    Vector3 drawPosition;
                    drawPosition.X = _currentMouseTileIndex.X * TILE_SIZE;
                    drawPosition.Y = mouseTile.Elevation * TILE_SIZE;
                    drawPosition.Z = _currentMouseTileIndex.Y * TILE_SIZE;

                    spriteBatch.DrawIsometric(
                        _selectionTextureDraw,
                        drawPosition,
                        _selectionColorDraw);
                }
            }
        }
 /// <summary>
 /// Draw everything on this screen
 /// </summary>
 public virtual void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
 {
     // TODO: Add general screen draw code here
 }
示例#9
0
        /// <summary>
        /// Load specified content
        /// </summary>
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatchIsometric(GraphicsDevice);

            TestingContent();
        }