Exemplo n.º 1
0
        private void DoSelectAction(Player p)
        {
            // Select a warp
            var world = GetWorldSelected(p);

            if (world != null)
            {
                if (world.Unlocked)
                    TransiteTo(world.Name + "Annunciation");
                else
                    ShowWarpBlockedMessage(p);

                return;
            }

            // Select a level
            var level = GetSelectedLevel(p);

            if (level != null)
            {
                GameScene currentGame = Main.GameInProgress;

                // Resume Game
                if (Main.GamePausedToWorld &&
                    currentGame.Simulator.LevelDescriptor.Infos.Id == level.Infos.Id &&
                    Simulator.PausedGameChoice == PausedGameChoice.Resume)
                {
                    currentGame.Simulator.State = GameState.Running;
                    TransiteTo(currentGame.Name);
                    return;
                }

                // Start a new game
                if (currentGame != null)
                    currentGame.StopMusic();

                currentGame = new GameScene("Game1", level);
                Main.GameInProgress = currentGame;
                currentGame.Simulator.AddNewGameStateListener(DoNewGameState);

                if (Visuals.GetScene(currentGame.Name) == null)
                    Visuals.AddScene(currentGame);
                else
                    Visuals.UpdateScene(currentGame.Name, currentGame);

                TransiteTo(currentGame.Name);

                return;
            }
        }
Exemplo n.º 2
0
        private void TransiteToNewGame(LevelDescriptor level)
        {
            Main.MusicController.StopCurrentMusic();

            var newGame = new GameScene(Name == "Game1" ? "Game2" : "Game1", level);
            Main.GameInProgress = newGame;
            newGame.Simulator.AddNewGameStateListener(Main.SelectedWorld.DoNewGameState);

            if (Visuals.GetScene(newGame.Name) == null)
                Visuals.AddScene(newGame);
            else
                Visuals.UpdateScene(newGame.Name, newGame);

            TransitingTo = newGame.Name;
            TransiteTo(TransitingTo);
        }