Ejemplo n.º 1
0
        /// <summary>
        /// Starts a new game, getting rid of the menu, deleting old saves, and opening up the starting room.
        /// </summary>
        private void StartNewGame()
        {
            if (gameMenu != null)
            {
                gameMenu.Dispose();
                gameMenu = null;
            }

            DeleteSave();

            GameResources.RoomSaves = new List<RoomSaveData>();

            StaticBGM.SwitchMusic("Level");

            currentRoom = new Room("StartRoom", -1);
            player = new Player(gameContent, SaveGame, SwitchRooms, DisplayInfoBox);
            player.Spawn(currentRoom.SpawnLocation);
            gameHUD = new HUD(gameContent, player);
            gameHUD.DisplayRoomName(currentRoom.LongName);

            isPaused = false;
            inGame = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the default settings for the game from the settings file
        /// </summary>
        public void Initialize(ContentManager gContent, GameServiceContainer services)
        {
            gameContent = gContent;
            GameResources.GameServices = services;

            oldKeyState = Keyboard.GetState();
            newKeyState = Keyboard.GetState();

            oldGamePadState = GamePad.GetState(PlayerIndex.One);
            newGamePadState = GamePad.GetState(PlayerIndex.One);

            LoadGameSettings();

            gameMenu = new MainMenu(MenuCallback, gameSettings);

            StaticBGM.InitializeMusic(gContent);

            StaticBGM.SwitchMusic("Main");

            fpsFont = gameContent.Load<SpriteFont>("Fonts/FPSFont");
            fpsCount = 0;
            oldCount = 0;
            drawCalls = 0;

            isFrozen = false;

            isDeathScreenUp = false;
        }