void Awake() { if (PersistentScoreInstance == null) { PersistentScoreInstance = gameObject.GetComponent <PersistentScore>(); } }
// Use this for initialization void Start() { int lv1 = PersistentScore.getHighScore(1); int lv2 = PersistentScore.getHighScore(2); highscoreLv1.text = "Score: " + lv1.ToString(); highscoreLv2.text = "Score: " + lv2.ToString(); }
private void GameOver() { PlayerPrefs.SetInt("Score", Score); string finishStatus = isFinishReached ? "true" : "false"; PlayerPrefs.SetString("finishStatus", finishStatus); if (isFinishReached) { PersistentScore.addHighScore(level, Score); } Application.LoadLevel(3); }