Пример #1
0
        /// <summary>
        /// Controlls which state the game is in and then draws the apropriate things on screen.
        /// </summary>
        /// <param name="_spriteBatch"></param>
        public static void Draw(SpriteBatch _spriteBatch)
        {
            // Start Menu
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Start)
            {
                Objects.menu.Draw(_spriteBatch);
            }

            // Settings Menu
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Settings)
            {
                Objects.settings.Draw(_spriteBatch);
            }

            // Map select
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Maps)
            {
                Objects.maps.Draw(_spriteBatch);
                Highscore.Draw(_spriteBatch);
            }

            // In Game
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.InGame)
            {
                // Affected by camera but behind player
                _spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, Objects.camera.Transform);
                Objects.map_print.Draw_floor(_spriteBatch);
                Objects.map_print.Draw(_spriteBatch);
                Shops.Draw(_spriteBatch);
                _spriteBatch.End();

                // Player
                _spriteBatch.Begin();
                Objects.player.Draw(_spriteBatch);
                _spriteBatch.End();

                // Affected by camera
                _spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, Objects.camera.Transform);
                Objects.bullets.Draw(_spriteBatch);
                Objects.weapon.Draw(_spriteBatch);
                Zombie_manager.Draw(_spriteBatch);
                _spriteBatch.End();

                _spriteBatch.Begin();
                In_Game.Draw(_spriteBatch);
                _spriteBatch.End();
            }

            // Paused
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Pause)
            {
                Pause.Draw(_spriteBatch);
            }
        }
Пример #2
0
        public Objects(Texture2D map1, Texture2D map2, Texture2D map3, Texture2D box, SpriteFont text)
        {
            // Statics
            Shops.Set_Texture(box);
            Zombie_manager.Get_Texture(box);

            //Objects
            settings = new Settings(box);
            maps     = new Maps(box, map1, map2, map3);
            font     = text;
            bullets  = new Bullets(box, new Vector2(2, 2));
            weapon   = new Weapons(box, new Rectangle(50, 50, 10, 5));
            player   = new Player(box, new Rectangle(20, 20, bodySize, bodySize));
            menu     = new Menu(box, new Vector2(350, 150));
        }
Пример #3
0
        public static void Update()
        {
            Collision.Update();
            Pause.Update();

            // Start Menu
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Start)
            {
                Objects.menu.Update();
            }

            // Settings menu
            if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Settings)
            {
                Objects.settings.Update();
            }


            // Map select
            else if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.Maps)
            {
                Objects.maps.Update();
            }

            // In Game
            else if (GAME_SETTINGS.Status == GAME_SETTINGS.Scene.InGame)
            {
                // statics
                Shoot.Update();
                Zombie_manager.Update();
                Shops.Update();
                Highscore.Update();

                // Objects
                Objects.bullets.Update();
                Objects.player.Update();
                Objects.weapon.Update();
            }
            Objects.camera.UpdateCamera(Objects.View);
        }
Пример #4
0
        public void Update()
        {
            // Next map
            if (Collision.Mouse_Click(body))
            {
                if (!click) // So the button doesn't get spammed
                {
                    index++;
                }
                click = true;
            }
            else
            {
                click = false;
            }

            if (index >= maps.Count)
            {
                index = 0;
            }


            /* Starts the game and resets several variables and lists, this is incase you've already played a map so
             * the old zombies, spawners, etc doesn't stick around for this time. */
            if (Collision.Mouse_Click(play_button))
            {
                // Resets the round timer
                Zombie_manager.Round_timer_reset();
                // Reset camera
                Objects.camera.Position = new Vector2(0, 0);
                // Generates map
                Objects.map = new Map_Generator(maps[index]);
                // Loads and prints map
                Objects.map_print = new Map_Printer(tex, Objects.bodySize);
                // Prepare all variables
                In_Game.start();
                GAME_SETTINGS.Status = GAME_SETTINGS.Scene.InGame;
            }
        }