Пример #1
0
        public virtual LevelResult Cleanup()
        {
            // Remove any trash in the process of being burned
            foreach (var incinerator in Incinerators)
            {
                incinerator.QuickFinishBurn();
            }

            var remainingWaste = wasteObjects.Count;
            var unspawnedWaste = GetTotalUnspawnedWaste();

            for (int i = wasteObjects.Count - 1; i >= 0; i--)
            {
                var waste = wasteObjects[i];
                GameManager.WastePool.ReturnObject(waste);
            }

            var carryOverWaste = remainingWaste + unspawnedWaste;

            var result = new LevelResult()
            {
                ScoreDelta     = LevelScore,
                LevelName      = LevelName,
                LevelTime      = LevelTime,
                WasteDelta     = LevelWasteBurned,
                CarryOverWaste = carryOverWaste,
                WasTimedLevel  = IsTimedLevel,
                GivenLevelTime = GivenLevelTime,
                GameOver       = CalculateGameOver()           // TODO: Determine loss condition
            };

            GameManager.DestroyCurrentLevel();
            return(result);
        }
Пример #2
0
        public void DisplayScoreCard(LevelResult result)
        {
            GameManager.PauseGame();
            OpenMenu();
            GotoScreen(ScoreCardScreen);
            ScoreBoard_Title.text      = result.GameOver ? "GAME OVER" : result.LevelName;
            ScoreBoard_SubTitle.text   = result.GameOver ? "You are a rubbish person!" : "Level Complete!";
            ScoreBoard_LevelScore.text = $"{result.ScoreDelta} pts";
            ScoreBoard_LevelWaste.text = $"{result.WasteDelta} units";
            ScoreBoard_TotalScore.text = $"{GameManager.Score} pts";
            ScoreBoard_TotalWaste.text = $"{GameManager.WasteBurned} units";
            ScoreBoard_LevelTime.text  = $"{(int)(result.LevelTime / 60)}:{(int)(result.LevelTime % 60)} min";
            ScoreBoard_NextLevelButton.SetActive(!result.GameOver);
            Debug.Log($@"
Level [{result.LevelName}] cleaned up.
Final Score: [{result.ScoreDelta}].
Waste Burned: [{result.WasteDelta}].
Remaining Waste: [{result.CarryOverWaste}]
Total Time: [{result.LevelTime}]
Game Over: [{result.GameOver}]
");
        }