public void UpdateScore() { int aliensCount = library.aliens.GetComponent <AlienController>().GetAlienCount(); scoreText.text = aliensCount + ""; int bestScore = PreferencesSaver.GetBestScore(); if (aliensCount > bestScore) { bestScore = aliensCount; PreferencesSaver.SetBestScore(bestScore); } bestScoreText.text = bestScore + ""; int currentMoney = (int)Mathf.Floor(aliensCount / GameplayConstants.MoneyDevider); currentMoneyText.text = currentMoney + ""; library.money.AddMoney(currentMoney); library.money.SaveMoney(); library.playGameServices.AdScore(aliensCount); }