Example #1
0
        public override Screen Copy()
        {
            int tempHealth1 = SpacewarGame.Players[0].Health;
            int tempHealth2 = SpacewarGame.Players[1].Health;

            RetroScreen retn = new RetroScreen(this.game);

            SpacewarGame.Players[0].Health = tempHealth1;
            SpacewarGame.Players[1].Health = tempHealth2;

            retn.bullets = this.bullets;
            retn.particles = this.particles;

            retn.paused = this.paused;
            retn.player1Score = this.player1Score;
            retn.player2Score = this.player2Score;
            retn.backdrop = this.backdrop;//Doesn't change so I won't deep copy
            retn.ReplaceScene(this.sun.Copy(), this.ship1.Copy(), this.ship2.Copy(), this.particles, this.bullets);

            return retn;
        }
Example #2
0
        internal void ChangeState(GameState NextState)
        {
            Screen currentScreen = UpdateBuff.screen;
            //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);
                UpdateBuff.state = GameState.LogoSplash;
            }
            else if (UpdateBuff.state == GameState.LogoSplash && NextState == GameState.ShipSelection)
            {
                Sound.PlayCue(Sounds.MenuAdvance);

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

                //Start at level 1
                gameLevel = 1;

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

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

                currentScreen.Shutdown();
                currentScreen = new RetroScreen(this);
                UpdateBuff.state = GameState.PlayRetro;
            }
            else if (UpdateBuff.state == GameState.PlayEvolved && NextState == GameState.Victory)
            {
                currentScreen.Shutdown();
                currentScreen = new VictoryScreen(this, false);
                UpdateBuff.state = 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()));
            }

            UpdateBuff.screen = currentScreen;
        }