Esempio n. 1
0
        internal void ChangeState(GameState NextState) {
            //Logo spash can come from ANY state since its the place you go when you restart
            if (NextState == GameState.LogoSplash) {
                if (currentScreen != null)
                    currentScreen.Shutdown();

                currentScreen = new TitleScreen(this);
                gameState = GameState.LogoSplash;
            } else if (gameState == GameState.LogoSplash && NextState == GameState.ShipSelection) {
                Sound.PlayCue(Sounds.MenuAdvance);

                //This is really where the game starts so setup the player information
                players = new Player[2] { new Player(), new Player() };

                //Start at level 1
                gameLevel = 1;

                currentScreen.Shutdown();
                currentScreen = new SelectionScreen(this);
                gameState = GameState.ShipSelection;
            } else if (gameState == GameState.PlayEvolved && NextState == GameState.ShipUpgrade) {
                currentScreen.Shutdown();
                currentScreen = new ShipUpgradeScreen(this);
                gameState = GameState.ShipUpgrade;
            } else if ((gameState == GameState.ShipSelection || GameState == GameState.ShipUpgrade) && NextState == GameState.PlayEvolved) {
                Sound.PlayCue(Sounds.MenuAdvance);

                currentScreen.Shutdown();
                currentScreen = new EvolvedScreen(this);
                gameState = GameState.PlayEvolved;
            } else if (gameState == GameState.LogoSplash && NextState == GameState.PlayRetro) {
                //Game starts here for retro
                players = new Player[2] { new Player(), new Player() };

                currentScreen.Shutdown();
                currentScreen = new RetroScreen(this);
                gameState = GameState.PlayRetro;
            } else if (gameState == GameState.PlayEvolved && NextState == GameState.Victory) {
                currentScreen.Shutdown();
                currentScreen = new VictoryScreen(this);
                gameState = GameState.Victory;
            } else {
                //This is a BAD thing and should never happen
                // What does this map to on XBox 360?
                //Debug.Assert(false, String.Format("Invalid State transition {0} to {1}", gameState.ToString(), NextState.ToString()));
            }
        }