Esempio n. 1
0
        public override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            gameBackground.Draw();

            //Console.WriteLine("map is " + GlobalsVar.Map.MapArray.Count + " " + GlobalsVar.Map.MapArray[GlobalsVar.Map.MapArray.Count - 1].Count);
            GlobalsVar.Map.Draw();
            foreach (Mob mob in GlobalsVar.Mobs)
            {
                mob.Draw(gameTime);
            }

            target.Draw(gameTime);

            foreach (Tower tower in towers)
            {
                tower.Draw(gameTime);
            }


            // Draw the Interface. Must be the last thing to draw in the scene. (Except menu).
            gameInterface.Draw(SceneManager.SpriteBatch);

            if (TransitionPosition > 0)
            {
                SceneManager.FadeBackBufferToBlack(1f - TransitionAlpha);

                GraphicsDevice.BlendState        = BlendState.Opaque;
                GraphicsDevice.DepthStencilState = DepthStencilState.Default;
                GraphicsDevice.SamplerStates[0]  = SamplerState.LinearWrap;
            }
        }
Esempio n. 2
0
        protected override void Draw(DemoTime time)
        {
            base.Draw(time);

            if (gameState.State == EGameState.MainMenu)
            {
                mainMenu.Draw(time);
                return;
            }

            if (gameState.State == EGameState.Game)
            {
                base.Draw(time);
                RenderTarget2D.Clear(Color4.Black);

                if (time.ElapseTime < 2)
                {
                    RenderTarget2D.DrawBitmap(_infoGamePanel,
                                              new SharpDX.RectangleF(RESOLUTION.Width / 2 - _infoGamePanel.Size.Width / 2, RESOLUTION.Height / 2 - _infoGamePanel.Size.Height / 2, _infoGamePanel.Size.Width, _infoGamePanel.Size.Height),
                                              1.0f, BitmapInterpolationMode.Linear);
                }

                BuildingsFactory.Draw(time);
                MobsFactory.Draw(time);
                _myCharacter.Draw(time);

                GameInterface.Draw(time);
                _timeLastDraw = time.ElapseTime;

                return;
            }
        }
Esempio n. 3
0
        public override void Draw(GameTime gameTime)
        {
            DrawingUtils.SpriteBatchBegin(gameRef.SpriteBatch);


            map.Draw(gameRef.SpriteBatch, player.Camera);

            foreach (Enemy e in enemies)
            {
                e.Draw(gameTime, gameRef.SpriteBatch);
            }

            foreach (NPC n in npcs)
            {
                n.Draw(gameTime, gameRef.SpriteBatch);
            }

            player.Draw(gameTime, gameRef.SpriteBatch);
            if (!player.IsShooting)
            {
                sprite.Draw(gameTime, gameRef.SpriteBatch, player.Camera);
            }
            else
            {
                shootingSprite.Draw(gameTime, gameRef.SpriteBatch, player.Camera);
            }
            gun.Draw(gameRef.SpriteBatch);

            base.Draw(gameTime);

            //TODO: perdaryti EquipmentScreen ir InventoryScreen kaip HUDComponent. Isimti is Game1 klases
            gameRef.EquipmentScreen.DrawItems(gameTime);
            gameRef.InventoryScreen.DrawItems(gameTime);

            if (drawEquipment)
            {
                inventoryManager.Draw(gameRef.SpriteBatch);
            }

            hudManager.Draw(gameRef.SpriteBatch);

            popUpManager.Draw(gameTime);
            gameInterface.Draw(gameRef.SpriteBatch);
            notifications.Draw(gameRef.SpriteBatch);

            DrawingUtils.SpriteBatchEnd(gameRef.SpriteBatch);
        }