コード例 #1
0
        // 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();
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 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());
 }