示例#1
0
 void Awake()
 {
     if (S == null)
     {
         S = this;
     }
     else
     {
         Debug.LogError("ERROR: ScoreManager.Awake(): S is already set!");
     }
     if (PlayerPrefs.HasKey("GolfHighScore"))
     {
         HIGH_SCORE = PlayerPrefs.GetInt("GolfHighScore");
     }
     score += SCORE_FROM_PREV_ROUND;
     SCORE_FROM_PREV_ROUND = 0;
 }
示例#2
0
    public void CardClicked(CardGolf cd)
    {
        switch (cd.state)
        {
        case eCardStateGolf.target:
            break;

        case eCardStateGolf.drawpile:
            MoveToDiscard(target);
            MoveToTarget(Draw());
            UpdateDrawPile();
            ScoreManagerGolf.EVENT(eScoreEventGolf.draw);
            FloatingScoreHandler(eScoreEventGolf.draw);
            break;

        case eCardStateGolf.tableau:
            bool     validMatch  = true;
            CardGolf tempCardRef = target;
            if (!cd.canClick)
            {
                validMatch = false;
            }
            if (!AdjacentRank(cd, target))
            {
                validMatch = false;
            }
            if (!validMatch)
            {
                return;
            }

            table.Remove(cd);
            MoveToTarget(cd);
            SetTableauFaces();
            ScoreManagerGolf.EVENT(eScoreEventGolf.putt);
            FloatingScoreHandler(eScoreEventGolf.putt);
            break;
        }
        CheckForGameOver();
    }
示例#3
0
    void GameOver(bool won)
    {
        round += 1;
        int score = ScoreManagerGolf.SCORE;

        if (won)
        {
            gameOverText.text    = "Round Over";
            roundResultText.text = "You won this round! \nRound Score: " + score;
            ShowResultsUI(true);
            ScoreManagerGolf.EVENT(eScoreEventGolf.gameWin);
            FloatingScoreHandler(eScoreEventGolf.gameWin);
        }
        else
        {
            gameOverText.text = "Game Over";
            if (round == 9)
            {
                if (ScoreManagerGolf.HIGH_SCORE >= score)
                {
                    string str = "You got the high score!\nHigh score: " + score;
                    roundResultText.text = str;
                }
            }
            else if (round < 9)
            {
                roundResultText.text = "Your score for Round " + round + " was: " + score;
            }
            else
            {
                roundResultText.text = "Your final score was: " + score;
            }
            ShowResultsUI(true);
            ScoreManagerGolf.EVENT(eScoreEventGolf.gameLoss);
            FloatingScoreHandler(eScoreEventGolf.gameLoss);
        }
        Invoke("ReloadLevel", reloadDelay);
    }