Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        // スコア取得
        for (int i = 0; i < ranknum; i++)
        {
            scores[i] = PlayerPrefs.GetInt(RankingKeys[i], 0);
        }
        // scoresの最後に今回のスコアを入れる
        scores[ranknum] = InGameScore.getScore();
        Score.text      = scores[ranknum].ToString();
        Debug.Log(InGameScore.getScore());

        // ソートしてスコアを表示
        Array.Sort(scores);
        Array.Reverse(scores);
        Score1st.text = scores[0].ToString();
        Score2nd.text = scores[1].ToString();
        Score3rd.text = scores[2].ToString();

        Debug.Log(scores[0]);
        Debug.Log(scores[1]);
        Debug.Log(scores[2]);
        Debug.Log(scores[3]);

        // スコア更新
        for (int i = 0; i < ranknum; i++)
        {
            PlayerPrefs.SetInt(RankingKeys[i], scores[i]);
        }
        // 保存
        PlayerPrefs.Save();
    }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject.name == Constants.PLAYER_NAME)
        {
            //Debug.Log("Good job");
            pauser.setGameOver(true);

            float score   = scoreDisplay.getScore();
            int   ranking = ScoreManager.instance().getRanking(score);
            yourScore.text = "You made it out in " + System.Math.Round(score, 2) + " seconds!";

            if (ranking != -1)
            {
                newHighscoreDisplay.gameObject.SetActive(true);
                highscoreNotify.text = "Your time is the " + ordinal(ranking + 1) + " best time!";

                // Hide the Play Again / Exit to Menu buttons to force them to enter a name
                endOfGameButtons.SetActive(false);
            }
        }
    }