IEnumerator PlayRoundCoroutine() { GameState state = GameManager.instance.state; yield return(new WaitForSeconds(.5f)); m_feedControl.Pay(); UpdateFoodCount(); UpdateHappinessCount(); Alert("Feeding the empire..."); yield return(new WaitForSeconds(ALERT_TIME)); m_investControl.Pay(); UpdateMoneyCount(); UpdateHappinessCount(); Alert("Managing investments..."); yield return(new WaitForSeconds(ALERT_TIME)); int taxes = m_MapManager.CollectTaxes(); state.m_Money += taxes; UpdateMoneyCount(); Alert("Collecting taxes..."); yield return(new WaitForSeconds(ALERT_TIME)); int harvest = m_MapManager.HarvestFarms(); if (harvest > 0) { state.m_Food += harvest; UpdateFoodCount(); Alert("Harvesting farms..."); yield return(new WaitForSeconds(ALERT_TIME)); } int mined = m_MapManager.Mine(); if (mined > 0) { state.m_Money += mined; UpdateMoneyCount(); Alert("Carving jade..."); yield return(new WaitForSeconds(ALERT_TIME)); } yield return(StartCoroutine(TileController.ExpandTiles())); if (state.enemyFactions.Count > 0) { foreach (Faction faction in state.enemyFactions) { int count = Random.Range(1, 3); for (int i = 0; i < count; i++) { if (faction != Faction.None) { faction.AddSoldier(); } } } Alert("The enemies have expanded their forces!"); yield return(new WaitForSeconds(ALERT_TIME)); foreach (Faction faction in state.enemyFactions) { bool expand = Random.value < Constants.CHANCE_TO_EXPAND; if (expand) { // -1 = unable to siege, 0 = basic expansion, 1 = successful siege to player, 2 = successful siege to nonplayer, 3 = failed siege int result = faction.MaybeSiege(); switch (result) { case 0: Alert("The enemy has expanded their territory!", SIEGE_ALERT_TIME); break; case 1: Alert("The enemy has taken some of your land!", SIEGE_ALERT_TIME); state.m_Happiness += Constants.FAILED_INVADE_HAPPINESS; state.m_Happiness = Mathf.Min(state.m_Happiness, 100); UpdateHappinessCount(); break; case 2: Alert("The enemies fought each other!", SIEGE_ALERT_TIME); break; case 3: Alert("The enemies failed to expand their land...", SIEGE_ALERT_TIME); break; } if (result != -1) { yield return(new WaitForSeconds(SIEGE_ALERT_TIME)); } } } } //Random Events if (Random.value < Constants.CHANCE_RANDOM_EVENT) { RandomEvents.RandomEvent randomEvent = RandomEvents.GetEvent(); yield return(StartCoroutine(EventPopup(randomEvent.message))); randomEvent.eventFunc(); Alert(randomEvent.alert); yield return(new WaitForSeconds(ALERT_TIME)); } if (Faction.GetPlayer().TerritoryCount() == 0) { GameManager.instance.LoadLose(); } else if (GameManager.instance.state.m_Happiness <= 0) { StartRebellion(); } else if (GameManager.instance.state.m_Happiness == 100) { GameManager.instance.LoadWin(); } NextRound(); }