예제 #1
0
    public void AddScore(int amount)
    {
        //This assumes we don't ever want to take away player score.
        //If we do, just change this accordingly.
        if (amount < 0)
        {
            Debug.LogError("Cannot add negative score.");
            return;
        }

        score += amount;

        if (score > highScore)
        {
            if (!achievedHighScore)
            {
                onNewHighscore.Invoke();
            }

            achievedHighScore = true;
            PlayerPrefs.SetInt(GetHighScorePref(Leaderboard.Username), score);
            highScore = score;
        }

        onScoreChanged.Invoke(score);
    }
    public void AddScore(int amount)
    {
        //This assumes we don't ever want to take away player score.
        //If we do, just change this accordingly.
        if (amount < 0)
        {
            Debug.LogError("Cannot add negative score.");
            return;
        }

        score += amount;
        onScoreChanged.Invoke(score);
    }
 public void TriggerOnScoreChangedEvent(int score)
 {
     OnScoreChangedEvent?.Invoke(score);
 }
예제 #4
0
 public void CallOnScoreChangedEvent(EventData ob = null) => OnScoreChangedEvent?.Invoke(ob);
예제 #5
0
 private void AddScore(Vector3 point)
 {
     score++;
     OnScoreChangedEvent?.Invoke(score);
 }
예제 #6
0
 public void OnFuelCollected()
 {
     fuelCollected++;
     OnScoreChangedEvent.Invoke(fuelCollected - 1, fuelCollected);
 }