示例#1
0
        public void Draw()
        {
            myGame.GraphicsDevice.Viewport = new Viewport(camX, 0, gameWidth, gameHeight);

            foreach (IBackground back in backgroundElements)
            {
                back.Draw();
            }
            foreach (IItem item in itemElements)
            {
                item.Draw();
            }
            foreach (IItem fireBall in fireBallList)
            {
                fireBall.Draw();
            }
            if (IsPaused)
            {
                pauseText.Draw();
            }
            if (mario.isVisible)
            {
                mario.MarioDraw();
            }
            foreach (IBlock block in envElements)
            {
                block.Draw();
            }
            foreach (IEnemy enemy in enemyElements)
            {
                if (enemy.position.X > (-myGame.GraphicsDevice.Viewport.X) - GameConstants.SquareWidth && enemy.position.X < ((-myGame.GraphicsDevice.Viewport.X) + GameConstants.ScreenWidth))
                {
                    enemy.Draw();
                }
            }
            scoreSystem.DisplayScore(mario.totalScore);
            scoreSystem.CoinSystem(mario.coin);
            scoreSystem.WorldSystem();
            scoreSystem.Time();
        }
示例#2
0
        public void Draw()
        {
            myGame.GraphicsDevice.Viewport = new Viewport(camX, 0, gameWidth, gameHeight);

            background.Draw();

            foreach (IBackground back in backgroundElements)
            {
                back.Draw();
            }
            foreach (IItem item in itemElements)
            {
                item.Draw();
            }
            if (IsPaused)
            {
                pauseText.Draw();
            }
            foreach (IBlock block in envElements)
            {
                block.Draw();
            }
            foreach (IEnemy enemy in enemyElements)
            {
                if (enemy.position.X > (-myGame.GraphicsDevice.Viewport.X) - 100 && enemy.position.X < ((-myGame.GraphicsDevice.Viewport.X) + GameConstants.ScreenWidth))
                {
                    enemy.Draw();
                }
            }
            if (mainCharacter.isVisible)
            {
                mainCharacter.MainCharDraw();
            }
            scoreSystem.DisplayHUDElements();
            windowManager.DisplayAllWindows();
        }