public void EndGame(int _friendlyScore, int _enemyScore, bool _wasDisconnect)
    {
        if (gameIsOver)
        {
            return;
        }

        gameIsOver = true;

        //SetNextButtonActive(false);


        originalBoardPos     = gameBoard.transform.position;
        originalKeyboardPos  = keyboard.transform.position;
        originalCluePanelPos = clueHolder.transform.position;
        originalPausePos     = pauseButton.transform.position;
        originalScorePos     = scoreHolder.transform.position;


        int timeBonus = Mathf.Max(0, GetTimeBonus());

        finalScore = _friendlyScore + timeBonus;

        if (HomeLogic.isUsingSkillz)
        {
            if (SkillzCrossPlatform.IsMatchInProgress())
            {
                SkillzCrossPlatform.UpdatePlayersCurrentScore(finalScore);
            }
        }

        int highscore = 0;

        if (PlayerPrefs.HasKey("highscore"))
        {
            highscore = PlayerPrefs.GetInt("highscore");
        }

        if (finalScore >= highscore) // for a new highscore
        {
            highscore = finalScore;
            PlayerPrefs.SetInt("highscore", highscore);
            highScoreText.color = friendlyScoreText.color;
        }

        timeBonusText.text     = timeBonus.ToString();
        friendlyScoreText.text = finalScore.ToString();
        bestWordScoreText.text = gameplayLogic.bestWordScore.ToString();
        numCluesText.text      = gameplayLogic.numClues.ToString();
        highScoreText.text     = highscore.ToString();

        StartCoroutine(EndGameCoroutine());
    }
 public void LeaveGame(int finalScore)
 {
     if (HomeLogic.isUsingSkillz)
     {
         if (SkillzCrossPlatform.IsMatchInProgress())
         {
             SkillzCrossPlatform.ReportFinalScore(finalScore);
         }
     }
     else
     {
         SceneManager.LoadScene("HomeScene");
     }
 }
Esempio n. 3
0
    public void scoreUpdate()
    {
        if (gameOver)
        {
            return;
        }

        uiScore += collector.GetComponent <Collect>().catcherScore;
        catchText.GetComponent <Text>().text = "+ " + collector.GetComponent <Collect>().catcherScore;
        catchText.SetActive(true);
        catchTextActive = true;
        previousTime    = Time.time;
        ballColor       = collector.GetComponent <Collect>().ballColor;

        if (SkillzCrossPlatform.IsMatchInProgress())
        {
            SkillzCrossPlatform.UpdatePlayersCurrentScore(uiScore);
        }
    }
Esempio n. 4
0
    public void gameOverActivate()
    {
        gameOver = true;

        gameOverScoreText.text = "YOUR SCORE" + "\r\n" + uiScore;
        gameOverComboText.text = "YOUR COMBO" + "\r\n" + combos;
        gameOverScoreText.gameObject.SetActive(true);
        gameOverComboText.gameObject.SetActive(true);

        if (PlayerPrefs.GetInt("HighScore") < uiScore)
        {
            PlayerPrefs.SetInt("HighScore", uiScore);
        }

        if (SkillzCrossPlatform.IsMatchInProgress())
        {
            SkillzCrossPlatform.ReportFinalScore(uiScore);
        }
    }
Esempio n. 5
0
    public int UpdateScore()
    {
        int s1 = 0;
        int s2 = 0;

        for (int i = 0; i < tiles.Length; i++)
        {
            if (localPlayerGrid[i] != "")
            {
                s1 += tiles[i].scoreMult * scoreMultiplier;
            }

            if (enemyPlayerGrid[i] != "")
            {
                s2 += tiles[i].scoreMult * scoreMultiplier;
            }
        }

        int scoreDelta = s1 - oldScore;

        scoreLogic.AddScore(scoreDelta, true, scoreText, s1);

        if (scoreDelta > bestWordScore)
        {
            bestWordScore = scoreDelta;
        }

        if (scoreDelta > 0)
        {
            numClues++;
            gameAudio.PlayOneShot(gameAudio.solvedClueAudio, 1.0f);
        }

        scoreDelta = s2 - oldEnemyScore;
        scoreLogic.AddScore(scoreDelta, false, enemyScoreText, s2);

        if (scoreDelta > bestWordScoreEnemy)
        {
            bestWordScoreEnemy = scoreDelta;
        }

        if (scoreDelta > 0)
        {
            numCluesEnemy++;
            gameAudio.PlayOneShot(gameAudio.enemySolvedClueAudio, 1.0f);
        }

        //scoreText.text = "ME: " + s1;
        //enemyScoreText.text = "YOU: " + s2;
        oldScore      = s1;
        oldEnemyScore = s2;


        if (HomeLogic.isUsingSkillz)
        {
            if (SkillzCrossPlatform.IsMatchInProgress())
            {
                SkillzCrossPlatform.UpdatePlayersCurrentScore(s1);
            }
        }

        return(s1);
    }