public DeclareWinner(GameOver gameOver, int winnerNum, string winnerName) { GameOver = gameOver; WinnerNum = winnerNum; WinnerName = winnerName; }
private void Update() { if (ShouldShowTutorial && !ShowedTutorial) { ShowedTutorial = true; ShouldShowTutorial = false; startMenu.Destroy(); startMenu = null; tutorialMenu = new TutorialMenu(); LateAddChild(tutorialMenu); ShowedMenu = false; } if (ShouldStartPlaying && !StartedPlaying) { StartedPlaying = true; ShouldStartPlaying = false; tutorialMenu.Destroy(); tutorialMenu = null; grid = new GameLoop(); LateAddChild(grid); ShowedMenu = false; SoundManager.Instance.Stop("MenuMusic"); SoundManager.Instance.Play("GameMusic"); } if (ShouldStopPlaying && !StoppedPlaying) { StoppedPlaying = true; ShouldStopPlaying = false; score = grid.Score; if (grid.GotTreasure) { gameOverWin = new GameOverWin(score); AddChild(gameOverWin); } else { gameOver = new GameOver(score); AddChild(gameOver); } grid.Destroy(); grid = null; SoundManager.Instance.Stop("fuelLow"); SoundManager.Instance.Stop("ambient"); SoundManager.Instance.Stop("drilling"); ShowedMenu = false; } if (ShouldShowMenu && !ShowedMenu) { ShouldShowMenu = false; ShowedMenu = true; ShowedTutorial = false; StartedPlaying = false; StoppedPlaying = false; ShowedLeaderboard = false; score = -1; gameOver?.Destroy(); leaderboard?.Destroy(); startMenu = new StartMenu(); AddChild(startMenu); SoundManager.Instance.Play("MenuMusic"); } if (ShouldShowLeaderboard && !ShowedLeaderboard) { ShouldShowLeaderboard = false; ShowedLeaderboard = true; gameOverWin.Destroy(); leaderboard = new Leaderboard(score); AddChild(leaderboard); } }