Пример #1
0
        private IEnumerator NextLevel(EventHandler overlapScreen, bool skipCalcScore)
        {
            Reset();
            if (!skipCalcScore)
            {
                var loop = true;
                ScoreGUIController.Show((s, e) => { loop = false; },
                                        LevelManager.LevelNumber, Player1, Player2);
                while (loop)
                {
                    yield return(null);
                }
                yield return(new WaitForSeconds(1.5f));

                if (overlapScreen == null)
                {
                    overlapScreen = (s, e) => { ScoreGUIController.Hide(); }
                }
                ;
                else
                {
                    overlapScreen += (s, e) => { ScoreGUIController.Hide(); }
                };
            }
            StartCoroutine(NextLevelLoadScreen(overlapScreen));
        }
Пример #2
0
        private IEnumerator ShowGameOver()
        {
            var player = FieldController.Instance.FindBlock(Block.Player1);

            if (player != null)
            {
                player.EditorMode = true;
            }

            player = FieldController.Instance.FindBlock(Block.Player2);
            if (player != null)
            {
                player.EditorMode = true;
            }

            // Show GameOver in game
            GameGUIController.Instance.ShowGameOver();
            yield return(new WaitForSeconds(5));

            Reset();

            // Show calc score
            AudioManager.EnableSecondarySound = true;
            var loop = true;

            ScoreGUIController.Show((s, e) => { loop = false; },
                                    LevelManager.LevelNumber, Player1, Player2);
            while (loop)
            {
                yield return(null);
            }
            ScoreGUIController.Hide();

            // Show final screen with GameOver
            FinalScreenController.Show();
            yield return(new WaitForSeconds(3));

            FinalScreenController.Hide();

            // Show high score
            var playerScore = Mathf.Max(Player1.Score, Player2.Score);

            if (playerScore > HiScore)
            {
                HiScore = playerScore;

                loop = true;
                HiScoreGUIController.Show(HiScore, (s, e) => { loop = false; });
                while (loop)
                {
                    yield return(null);
                }
                HiScoreGUIController.Hide();
            }

            LevelManager.Reset();
            MainMenuController.Show(Player1.Score, Player2.Score);
        }