void MightWannaSaveDataHere(GameResultStats stats) { thisPlayerDataManager.SetFileIndex(0); if (!thisPlayerDataManager.PlayerDataIsLoaded()) { thisPlayerDataManager.Load(); } int currency = thisPlayerDataManager.GetCurrency(); int newCurrency = currency + stats.gainedCurrency + stats.scoreCurrencyBonus; thisPlayerDataManager.SetCurrency(newCurrency); int score = stats.score; int highScore = thisPlayerDataManager.GetHighScore(); if (score > highScore) { thisPlayerDataManager.SetHighScore(score); } thisPlayerDataManager.Save(); }