internal void UpdateScoreManager()
    {
        timeDistribution.UpdateAverages();

        PlayerPrefs.SetInt("TotalPopulation" + (PlayerPrefs.GetInt("saved_total") - 1), totalPopulation);                              //set the new total value
        PlayerPrefs.SetInt("TotalBabies" + (PlayerPrefs.GetInt("saved_total") - 1), agentsCreator.HowManyAgentsWereBorned);            //set the new total value
        PlayerPrefs.SetInt("DeathsAge" + (PlayerPrefs.GetInt("saved_total") - 1), deathsHandler.HowManyAgentsDied);                    //set the new total value
        PlayerPrefs.SetInt("DeathsEaten" + (PlayerPrefs.GetInt("saved_total") - 1), deathsHandler.HowManyAgentsWereEaten);             //set the new total value
        PlayerPrefs.SetInt("DeathsStarved" + (PlayerPrefs.GetInt("saved_total") - 1), deathsHandler.HowManyAgentsWereStarved);         //set the new total value
        PlayerPrefs.SetInt("TotalDeaths" + (PlayerPrefs.GetInt("saved_total") - 1), totalAgentsDied);                                  //set the new total value
        PlayerPrefs.SetFloat("AverageFood" + (PlayerPrefs.GetInt("saved_total") - 1), timeDistribution.AverageFoodTime);               //set the new total value
        PlayerPrefs.SetFloat("AverageBridges" + (PlayerPrefs.GetInt("saved_total") - 1), timeDistribution.AverageBridgesTime);         //set the new total value
        PlayerPrefs.SetFloat("AverageHouses" + (PlayerPrefs.GetInt("saved_total") - 1), timeDistribution.AverageHouseTime);            //set the new total value
        PlayerPrefs.SetFloat("AverageProcreation" + (PlayerPrefs.GetInt("saved_total") - 1), timeDistribution.AverageProcreationTime); //set the new total value
        PlayerPrefs.Save();

        scoreManager.SetScore(PlayerPrefs.GetString("UserName"), PlayerPrefs.GetString("DisplayName"), totalPopulation, agentsCreator.HowManyAgentsWereBorned, new int[] { deathsHandler.HowManyAgentsDied, deathsHandler.HowManyAgentsWereEaten, deathsHandler.HowManyAgentsWereStarved, totalAgentsDied },
                              new float[] { timeDistribution.AverageFoodTime, timeDistribution.AverageBridgesTime, timeDistribution.AverageHouseTime, timeDistribution.AverageProcreationTime });

        if (daysPassed < timeDistribution.DaysPassed)
        {
            daysPassed = timeDistribution.DaysPassed;

            LogfileWriter.GetInstance().WriteLogline(daysPassed, totalPopulation, agentsCreator.HowManyAgentsWereBorned,
                                                     new int[] { deathsHandler.HowManyAgentsDied, deathsHandler.HowManyAgentsWereEaten, deathsHandler.HowManyAgentsWereStarved, totalAgentsDied },
                                                     new float[] { timeDistribution.FoodTime, timeDistribution.BridgesTime, timeDistribution.HousesTime, timeDistribution.ProcreationTime },
                                                     new float[] { timeDistribution.AverageFoodTime, timeDistribution.AverageBridgesTime, timeDistribution.AverageHouseTime, timeDistribution.AverageProcreationTime });
        }
    }