// If shape can't fit anywhere on the board change its color to grey private void ChangeColorOfUnfitShape() { int numberOfUnfitShapes = 0; foreach (Shape shape in _shapesInPlay) { if (shape) { shape.ChangeToInitialColor(); if (!_gameBoard.CanShapeFitAnywhere(shape)) { shape.ChangeShapeColor(_unfitColor); numberOfUnfitShapes++; if (_numberOfShapesInPlay > 0) { if (_numberOfShapesInPlay == numberOfUnfitShapes) { if (_scoreManager.IsNewHighScore()) { CheckAndUpdateHighScore(); SoundManager.Instance.PlayHighScoreGameOverSound(); } else { SoundManager.Instance.PlayGameOverSound(); } _uiManager.SetGameOverMenuHighScoreUI(_scoreManager.GetScore()); _uiManager.OpenGameOverMenu(); } } } } } }
private void MissHandler() { _isGameOver = true; SoundManager.Instance.PlayGameOverSound(); _uiManager.OpenGameOverMenu(); PauseGame(); if (_scoreManager.IsNewHighScore()) { PlayerPrefs.SetInt("highscore", _scoreManager.GetHighScore()); _uiManager.SetHighScoreUI(_scoreManager.GetScore()); } _uiManager.SetGameOverMenuHighScoreUI(_scoreManager.GetScore()); }