Exemple #1
0
 internal bool DidPressAndReleaseKey(char a_key)
 {
     return(m_inputHandler.PressedAndReleased(a_key));
 }
Exemple #2
0
        /// <summary>
        /// Main drawing method.
        /// Draws all in game content.
        /// </summary>
        /// <param name="elapsedTime">Elapsed time in milleseconds</param>
        internal void DrawAndUpdate(float elapsedTime)
        {
            _inputHandler.MouseIsOverLoot = false;

            //Get player object
            Model.Player player = _gameModel.PlayerSystem.Player;

            //Updating player camera
            _camera.UpdateCamera();
            _spriteBatch.Begin();

            //Drawing background layers
            _gameModel.CurrentMap.DrawLayer(_spriteBatch, _gameModel.Level.IndexBackgroundLayerOne, _camera.GetScreenRectangle, 0f);
            _gameModel.CurrentMap.DrawLayer(_spriteBatch, _gameModel.Level.IndexBackgroundLayerTwo, _camera.GetScreenRectangle, 0f);
            _gameModel.CurrentMap.DrawLayer(_spriteBatch, _gameModel.Level.IndexBackgroundLayerThree, _camera.GetScreenRectangle, 0f);

            //Drawing items, units and spells
            DrawItems(elapsedTime, player);
            _unitView.DrawAndUpdateUnits(elapsedTime);
            DrawSpells(_gameModel.PlayerSystem.SpellSystem.ActiveSpells, elapsedTime);
            DrawSpells(_gameModel.EnemySystem._enemySpellSystem.ActiveSpells, elapsedTime);

            //Drawing foreground layers
            if (_gameModel.Level.ForegroundVisible)
            {
                _gameModel.CurrentMap.DrawLayer(_spriteBatch, _gameModel.Level.IndexForeground, _camera.GetScreenRectangle, 0f);
            }

            //Drawing dialog boxes, user interface and zone texts
            DrawDialogBoxes(player);
            _UIView.DrawAndUpdate(elapsedTime);
            DrawZoneText();

            #region DEBUG - Show objectlayers

            if (_inputHandler.PressedAndReleased(InputHandler.Input.DEBUG_MODE))
            {
                _showDebug = !_showDebug;
            }

            if (_showDebug)
            {
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexCollision, _camera.GetScreenRectangle, 0f);
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexInteraction, _camera.GetScreenRectangle, 0f);
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexFriendlyNPC, _camera.GetScreenRectangle, 0f);
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexEnemyNPC, _camera.GetScreenRectangle, 0f);
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexItems, _camera.GetScreenRectangle, 0f);
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexPlayer, _camera.GetScreenRectangle, 0f);
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexEnemyZone, _camera.GetScreenRectangle, 0f);
                _gameModel.CurrentMap.DrawObjectLayer(_spriteBatch, _gameModel.Level.IndexGraveyard, _camera.GetScreenRectangle, 0f);
            }

            #endregion

            _spriteBatch.End();

            //Repeat the camera uodate (fix)
            _camera.UpdateCamera();

            UpdateMusic();
        }