// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { EventManager.TriggerEvent("trigger_pause", new object[] { }); } if (mLastProceeded == (int)Time.timeSinceLevelLoad || mIsOver) { return; } if (mAdultPool.TotalMales == 0 || mAdultPool.TotalFemales == 0) { Debug.Log("GAME OVER"); GameOver(); return; } mYear = (int)Time.timeSinceLevelLoad / LengthOfAYear; mLastProceeded = (int)Time.timeSinceLevelLoad; // Proceed ticked updated if (ShouldTick(InfantileDeathTick)) { Mechanics.ProceedChildren(ref mChildrenPool, InfantMortalityRate); } if (ShouldTick(AdultDeathTick)) { Mechanics.ProceedAdult(ref mAdultPool, MaleMortalityRate, FemaleMortalityRate, MaleMortalityModifier, FemaleMortalityModifier); } EventManager.TriggerEvent("population_update", new object[] { mAdultPool.TotalMales, mAdultPool.TotalFemales, ChildrenPopulation, MaximumPopulation }); // Update food amount if (ShouldTick(FoodProductionTick)) { Mechanics.ProceedFood(ref FoodAmount, NormalizedRate(FoodProductionRate, FoodProductionTick), FoodProductionModifier); } // Proceed game loop if (IsNewYear()) { Mechanics.ProceedNewYear(mYear, ref mChildrenPool, NumberOfChildrenPool, ref mAdultPool, MaximumPopulation, ChildrenPopulation, ref FoodAmount); if (mChildrenPool[mYear % NumberOfChildrenPool].children > 0) { EventManager.TriggerEvent("population_update", new object[] { mAdultPool.TotalMales, mAdultPool.TotalFemales, ChildrenPopulation, MaximumPopulation }); } } }