Ejemplo n.º 1
0
        public void EndGame(string status)
        {
            SwinGame.PlayMusic(GameResources.GameMusic("main_menu_music"));
            bool proceed = false;

            // IA - Reset minerals, game levels, food purchased and energy levels.
            Food.SetBalance(0);
            Food.ResetFoodPurchased();
            Food.ResetMineralValue();
            Food.ResetEnergyValue();
            MetaHandler.ResetEnergyLevels();
            MetaHandler.SetFoodMessage("Hit Space to enter amount.");
            MetaHandler.ResetAmmunitionMessage1();
            MetaHandler.ResetAmmunitionMessage2();
            GameLevel.SetLevel(1);
            EnemiesToBeRemoved.Clear();
            GetPlayer().DestroyWeapon();

            // IA - Clear the input field from the Food Exchange Center
            if (Input.ReadingText())
            {
                Input.EndReadingText();
            }


            GetPlayer().Inventory.ClearInventory();
            if (_twoplayer == true)
            {
                _player2.Inventory.ClearInventory();
                _player2.DestroyWeapon();
            }


            while (!proceed)
            {
                SwinGame.ClearScreen(Color.White);
                SwinGame.DrawBitmap(GameResources.GameImage(status), 0, 0);

                SwinGame.ProcessEvents();

                if (SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    if (_twoplayer == true)
                    {
                        _player2.Location.X = 45;
                        _player2.Location.Y = 30;
                    }
                    proceed     = true;
                    initdone    = false;
                    initdone2   = false;
                    initPlayer2 = false;
                    _twoplayer  = false;
                    firstGame   = false;
                }

                SwinGame.RefreshScreen(60);
            }
            SwinGame.ClearScreen(Color.White);
            _gameStates.Push(GameState.ViewingMainMenu);
            ControlGameState();
        }