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); }
public void CallOnScoreChangedEvent(EventData ob = null) => OnScoreChangedEvent?.Invoke(ob);
private void AddScore(Vector3 point) { score++; OnScoreChangedEvent?.Invoke(score); }
public void OnFuelCollected() { fuelCollected++; OnScoreChangedEvent.Invoke(fuelCollected - 1, fuelCollected); }