Example #1
0
        public void GameOver(GameOverType gameOverType, bool waitForFrame)
        {
            if (!gameActive && waitForFrame)
            {
                return;
            }
            gameActive = false;

            if (waitForFrame)
            {
                // mecanim doesn't trigger the event if we wait until the frame is over
                playerController.GameOver(gameOverType);
                StartCoroutine(WaitForFrameGameOver(gameOverType));
            }
            else
            {
                inputController.GameOver();
                // Mission Manager's gameOver must be called before the Data Manager's gameOver so the Data Manager can grab the
                // score multiplier from the Mission Manager to determine the final score
                missionManager.GameOver();
                coinGUICollection.GameOver();
                // Only call game over on the DataManager if there is no chance a revive is going to happen. We don't want to forget
                // the values stored in the data manager if a revive does happen
                if (!allowRevives || !dataManager.CanRevive() || !dataManager.CanPurchaseRevive())
                {
                    dataManager.GameOver();
                }
                if (playerController.enabled)
                {
                    playerController.GameOver(gameOverType);
                }
                if (chaseController != null)
                {
                    chaseController.GameOver(gameOverType);
                }
                audioManager.PlayBackgroundMusic(false);
                if (gameOverType != GameOverType.Quit)
                {
                    audioManager.PlaySoundEffect(SoundEffects.GameOverSoundEffect);
                }
                guiManager.GameOver();
                cameraController.GameOver(gameOverType);
            }
        }