示例#1
0
    void HighScoreDisplay()
    {
        Text  highScoreDisplayText = highScoreDisplay.GetComponent <Text>();
        float score = scoreScript.GetHighScore();

        highScoreDisplayText.text = "High Score: " + scoreScript.GetHighScore().ToString();
    }
示例#2
0
    public void AddScore(int points)
    {
        scaleFactor += points * scaleIncreasePerPoint;
        if (VRMode)   // smaller scale limit for VR tablet screen
        {
            if (scaleFactor > 1.1f)
            {
                scaleFactor = 1.1f;
            }
        }
        else
        {
            if (scaleFactor > 5.0f)
            {
                scaleFactor = 5.0f;
            }
        }
        scoreNow       += points;
        scoreLabel.text = "Score: " + scoreNow;

        string levelName = SceneManager.GetActiveScene().name;
        int    stage     = PlayerPrefs.GetInt("stageNow", 0);

        stage = Mathf.Clamp(stage, 0, 4);
        TimePeriod time            = (TimePeriod)stage;
        int        savedHighScores = HighScores.GetHighScore(levelName, time.ToString());

        if (savedHighScores < scoreNow)
        {
            HighScores.SaveHighScore(levelName, time.ToString(), scoreNow);
            highScoreLabel.text = "High Score: " + HighScores.GetHighScore(levelName, time.ToString());
        }
    }
示例#3
0
    void Start()
    {
        for (int i = 0; i < sums.Length; i++)
        {
            sums[i] = 0;
        }

        for (int i = 0; i < periodTimes.Length; i++)
        {
            scores_Desert[i]            = HighScores.GetHighScore(LevelName.City, (TimePeriod)i);
            sums[ROW_DESERT]           += scores_Desert[i];
            periodLabels_Desert[i].text = periodTimes[i] + "\nScore: " + scores_Desert[i];

            scores_Ocean[i]            = HighScores.GetHighScore(LevelName.Ocean, (TimePeriod)i);
            sums[ROW_OCEAN]           += scores_Ocean[i];
            periodLabels_Ocean[i].text = periodTimes[i] + "\nScore: " + scores_Ocean[i];

            scores_Country[i]  = HighScores.GetHighScore(LevelName.Countryside, (TimePeriod)i);
            sums[ROW_COUNTRY] += scores_Country[i];
            periodLabels_Countryside[i].text = periodTimes[i] + "\nScore: " + scores_Country[i];

            scores_Chaos[i]            = HighScores.GetHighScore(LevelName.ChaosDimension, (TimePeriod)i);
            sums[ROW_CHAOS]           += scores_Chaos[i];
            periodLabels_Chaos[i].text = periodTimes[i] + "\nScore: " + scores_Chaos[i];
        }

        for (int i = 0; i < sceneLabels.Length; i++)
        {
            sceneLabels[i].text = sceneNames[i] + "\nTotal: " + sums[i];
        }

        UpdateAllScore();
    }
示例#4
0
    void Start()
    {
        VRMode           = (GameObject.Find("XRRig") != null);
        instance         = this;
        scoreLabel       = GameObject.Find("Score Label").GetComponent <TextMeshProUGUI>();
        highScoreLabel   = GameObject.Find("High Score Label").GetComponent <TextMeshProUGUI>();
        scoreLabelParent = scoreLabel.transform.parent;

        AddScore(0);

        string levelName = SceneManager.GetActiveScene().name;
        int    stage     = PlayerPrefs.GetInt("stageNow", 0);

        stage = Mathf.Clamp(stage, 0, 4);
        TimePeriod time = (TimePeriod)stage;

        highScoreLabel.text = "High Score: " + HighScores.GetHighScore(levelName, time.ToString());
    }