public void Save(ScoreAmount score) { using (FileStream fs = new FileStream(_path, FileMode.OpenOrCreate)) { _xmlSerializer.Serialize(fs, score); } }
private void StartGameOver() { _isGameOver = true; _gameOverMenu.ShowMenu(); ScoreAmount recordData = _scoreSaver.Load(); ScoreAmount scoreData = _scoreCounter.SaveData; if (CurrentAuth.type != AuthType.Anonymous) { _leaderboardController.SendScore(scoreData.score); } if (scoreData.score > recordData.score) { _scoreSaver.Save(scoreData); _gameOverMenu.ChangeScore(scoreData.score, scoreData.score, true); } else { _gameOverMenu.ChangeScore(scoreData.score, recordData.score, false); } }