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 });
        }
    }
Beispiel #2
0
    public void OnSaveNameBtnPress()
    {
        int total = 0;

        total = PlayerPrefs.GetInt("saved_total"); //set the total variable to the previously saved value
        PlayerPrefs.SetString("UserName" + total, ((playerNameTxtbox.GetComponent("InputField") as InputField).text));

        PlayerPrefs.SetString("DisplayName", ((playerNameTxtbox.GetComponent("InputField") as InputField).text));      //set the new total value
        PlayerPrefs.SetString("UserName", ((playerNameTxtbox.GetComponent("InputField") as InputField).text) + total); //set the new total value

        total += 1;
        PlayerPrefs.SetInt("saved_total", total); //set the new total value
        PlayerPrefs.Save();

        playerNameTxtbox.transform.parent.gameObject.SetActive(false);

        Time.timeScale = 1;

        if (toggleDecay.GetComponent <Toggle>().isOn)
        {
            PlayerPrefs.SetInt("Decay", 1);
        }
        if (toggleImmigration.GetComponent <Toggle>().isOn)
        {
            PlayerPrefs.SetInt("Immigration", 1);
        }
        if (toggleFloods.GetComponent <Toggle>().isOn)
        {
            floodManager.GetComponent <FloodingManager>().enabled = true;
        }

        LogfileWriter.GetInstance().Createfile();
    }
 internal void WriteLogAfterFlood()
 {
     LogfileWriter.GetInstance().WriteFloodLine(daysPassed, "AfterFlood");
     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 });
     LogfileWriter.GetInstance().WriteFloodLine(daysPassed, "AfterFlood");
 }