public bool init() { //GameObject.FindGameObjectWithTag("Logic").GetComponent<PhaseManager>().readJSON(); _tileSelectedPosition = new uint[2] { 28, 25 }; _hasTileSelected = false; m_monthsInRed = 0; m_monthsSinceIShowedInRedPopup = 0; b_warningInRedPopupShown = false; //_terrainLogic = new RiceTerrainLogic(); ActionManager.GetInstance(); CoopManager.GetInstance(); PenalizationManager.GetInstance(); WorldTerrain.GetInstance().initWorld(); BuildingsManager.GetInstance().init(); UserDataManager.GetInstance().init(); UserDataManager.GetInstance().gold.setGold(6800); RiceObjectsManager.GetInstance(); _cloudSpawner = new CloudSpawner(WorldTerrain.CLOUDS_Z_LAYER); _tutMan.startTuto(new Tutorial_Inicial()); GameSaveDataManager.init(); return(true); }
public void newYearUpdate() { //int newScore = Math.Min(5, instancesFlamingos.Count + 1); test int newScore = CoopManager.GetInstance().getCurrentEcologyLevel(); scoresLastYears.Dequeue(); scoresLastYears.Enqueue(newScore); int newNumOfFlamingos = 0; foreach (int sc in scoresLastYears) { newNumOfFlamingos += sc; } int oldNumOfFlamingos = instancesFlamingos.Count; for (int i = 0; i < Math.Abs(newNumOfFlamingos - oldNumOfFlamingos); ++i) { if (newNumOfFlamingos > oldNumOfFlamingos) { createFlamingo(); } else { deleteFlamingo(); } } }
public void applyFertilizer(bool isEco) { if (!isEco) { CoopManager.GetInstance().loseEcologyFertilizerPoint(); } }
public void sellRice(uint riceToSell) { //rice.addRiceSold(riceToSell); float coopBonus = CoopManager.GetInstance().getCurrentTotalProductionBonus() / 100.0f; float invBonus = InvestigationManager.GetInstance().getGoldBonusPerRiceSold() / 100.0f; gold.addRiceGold(riceToSell * (LogicManager.PRICE_PER_RICE + LogicManager.PRICE_PER_RICE * coopBonus + LogicManager.PRICE_PER_RICE * invBonus)); }
public int getCapacity2() { int capacity = _constructionLevels[_level].capacity2; Pair <int, int> bonus = CoopManager.GetInstance().getCurrentAnualProductionBonus(); capacity += (capacity * bonus.Second) / 100; return(capacity); }
public void applyHerbicide(bool isEco) { _weed.delete(); _bHasAppliedHerbicide = true; if (!isEco) { CoopManager.GetInstance().loseEcologyWeedControlPoint(); } }
void init() { Text m_riceProductionNumberText = GameObject.Find("RiceProductionNumberText").GetComponent <Text>(); Text m_riceSoldNumberText = GameObject.Find("RiceSoldNumberText").GetComponent <Text>(); Text m_riceLostNumberText = GameObject.Find("RiceLostNumberText").GetComponent <Text>(); Text m_grantEcologyNumberText = GameObject.Find("EcologyGrantNumberText").GetComponent <Text>(); UserDataManager userData = UserDataManager.GetInstance(); uint anualProduction = userData.getRiceProducedThisYear(); m_riceProductionNumberText.text = anualProduction.ToString(); WorldTerrain wt = WorldTerrain.GetInstance(); InvestigationManager invMan = InvestigationManager.GetInstance(); //uint riceOfChunksDisabled = (uint) wt.getNumberOfChunks() * RiceTerrainTile.MAX_RICE_UNITS * WorldTerrain.RICE_CHUNK_W * WorldTerrain.RICE_CHUNK_H; //uint riceLostThisYear = userData.getRiceLostThisYear() + riceOfChunksDisabled; uint riceLostThisYear = (uint)(wt.getNumberOfChunks() * RiceTerrainTile.MAX_RICE_UNITS * WorldTerrain.RICE_CHUNK_W * WorldTerrain.RICE_CHUNK_H * (1 + invMan.getRicePerChunkBonus() * 0.01f) - anualProduction); m_riceLostNumberText.text = riceLostThisYear.ToString(); int anualRiceSold = userData.gold.getRiceGoldAddThisYear(); m_riceSoldNumberText.text = anualRiceSold.ToString(); bool ecoGrant = InvestigationManager.GetInstance().isInvestigated(INVESTIGATIONS_ID.ECO_SUBVENCION); if (ecoGrant) { int ecoGrantBonus = CoopManager.GetInstance().getCurrentEcologyBonus(); m_grantEcologyNumberText.text = ecoGrantBonus.ToString(); } else { m_grantEcologyNumberText.text = ""; GameObject.Find("EcologyGrantText").GetComponent <Text>().enabled = false; GameObject.Find("EcologyGrantNumberUnits").GetComponent <Image> ().enabled = false; GameObject.Find("EcologyGrantButtonHelp").SetActive(false); } RankingManager.GetInstance().addScore((int)anualProduction); CoopManager.GetInstance().happyNewYear(); UserDataManager.GetInstance().resetYearlyData(); /* * const float TON = 1000000.0f; * if (anualRiceSold < TON) { * m_riceProductionNumberText.text = anualRiceSold.ToString (); * } else { * m_riceProductionNumberText.text = (anualRiceSold / TON).ToString ("0.00"); * m_riceProductionNumberUnitsText = "T"; * } */ GameObject.Find("Logic").GetComponent <TimeManager> ().pauseTime(); }
public static void init() { m_am = ActionManager.GetInstance(); m_bm = BuildingsManager.GetInstance(); m_tm = GameObject.Find("Logic").GetComponent <TimeManager>(); m_cm = CoopManager.GetInstance(); m_um = UserDataManager.GetInstance(); m_im = InvestigationManager.GetInstance(); m_lm = GameObject.Find("Logic").GetComponent <LogicManager>(); m_pm = PenalizationManager.GetInstance(); m_phasem = GameObject.FindGameObjectWithTag("Logic").GetComponent <PhaseManager>(); m_plaguem = PlagueManager.GetInstance(); m_rm = RankingManager.GetInstance(); m_rom = RiceObjectsManager.GetInstance(); m_workerm = WorkerManager.GetInstance(); m_worldm = WorldTerrain.GetInstance(); m_tutMan = GameObject.FindGameObjectWithTag("Tutorial").GetComponent <TutorialManager> (); }
private void updateCoopList() { int expansionLevel = Math.Max(CoopManager.GetInstance().getCurrentExpansionLevel(), 1); m_coopPanelImages[(int)MilestoneType.EXPANSION].sprite = Resources.Load <Sprite>(IMG_EXPANSION_PATH + expansionLevel); int ecologyLevel = Math.Max(CoopManager.GetInstance().getCurrentEcologyLevel(), 1); m_coopPanelImages[(int)MilestoneType.ECOLOGY].sprite = Resources.Load <Sprite>(IMG_ECOLOGY_PATH + ecologyLevel); int productionLevel = Math.Max(CoopManager.GetInstance().getCurrentTotalProductionLevel(), 1); m_coopPanelImages[(int)MilestoneType.PRODUCTION].sprite = Resources.Load <Sprite>(IMG_PRODUCTION_PATH + productionLevel); int anualProductionLevel = Math.Max(CoopManager.GetInstance().getCurrentAnualProductionLevel(), 1); m_coopPanelImages[(int)MilestoneType.ANUAL_PRODUCTION].sprite = Resources.Load <Sprite>(IMG_ANUAL_PRODUCTION_PATH + anualProductionLevel); }
public void load(LogicManagerData logicManagerData) { _tileSelectedPosition = new uint[2] { 26, 15 }; _hasTileSelected = false; ActionManager.GetInstance(); CoopManager.GetInstance(); PenalizationManager.GetInstance(); //WorldTerrain.GetInstance().initWorld(); //BuildingsManager.GetInstance().init(); UserDataManager.GetInstance().init(); RiceObjectsManager.GetInstance(); _cloudSpawner = new CloudSpawner(WorldTerrain.CLOUDS_Z_LAYER); gameObject.GetComponent <TimeManager>().addListenerToYearChange(this.happyNewYear); gameObject.GetComponent <TimeManager>().addListenerToMonthChange(happyNewMonth); gameObject.GetComponent <TimeManager>().addListerToDayChange(this.newDayCallback); }
public void ClearOneChunk(int id) { if (visitedChunk != null && visitedChunk.Length > id) { //TO DO: CAREFUL SOMETIMES THIS IS NULL IDK WHY if (!visitedChunk [id]) { remainingChunks--; visitedChunk [id] = true; if (activePlague.getID() == 1) { CoopManager.GetInstance().loseEcologyPlageControlPoint(); } if (remainingChunks == 0) { cleanPlague(); } } } }
private void updateSelectedMilestone() { string milestoneDescription = ""; string currentBonus = ""; string nextBonus = ""; CoopManager coopMan = CoopManager.GetInstance(); switch (m_selectedMilestone) { case MilestoneType.EXPANSION: if (!coopMan.expansionBonusIsInMaxLvl()) { milestoneDescription = Dictionary.getString("CURRENTLY_YOU_HAVE") + " " + WorldTerrain.GetInstance().getNumberOfChunks() + " " + Dictionary.getString("OF") + " " + CoopManager.GetInstance().getNextExpansionGoal() + " " + Dictionary.getString("FIELDS_CURRENT_GOAL"); } else { milestoneDescription = Dictionary.getString("MAX_BONUS"); } currentBonus = Dictionary.getString("CURRENT_BONUS") + ": " + coopMan.getCurrentExpansionBonus() + Dictionary.getString("OBJECT_DISCOUNT"); if (!coopMan.expansionBonusIsInMaxLvl()) { nextBonus = Dictionary.getString("NEXT_BONUS") + ": " + coopMan.getNextExpansionBonus() + Dictionary.getString("OBJECT_DISCOUNT"); } break; case MilestoneType.ECOLOGY: if (!Tutorial_Ecology.init) { TutorialManager tutMan = GameObject.FindGameObjectWithTag("Tutorial").GetComponent <TutorialManager> (); tutMan.startTuto(new Tutorial_Ecology()); } if (!coopMan.ecologyBonusIsInMaxLvl()) { milestoneDescription = Dictionary.getString("YOU_HAVE") + " " + coopMan.getLastYearEcologyScore() + " " + Dictionary.getString("ECOLOGY_MILESTONE_DESC"); } else { milestoneDescription = Dictionary.getString("MAX_BONUS"); } currentBonus = Dictionary.getString("CURRENT_BONUS") + ": " + coopMan.getCurrentEcologyBonus() + " " + Dictionary.getString("COINS_PER_YEAR"); if (!coopMan.ecologyBonusIsInMaxLvl()) { nextBonus = Dictionary.getString("NEXT_BONUS") + ": " + coopMan.getNextEcologyBonus() + " " + Dictionary.getString("COINS_PER_YEAR"); } break; case MilestoneType.PRODUCTION: if (!coopMan.totalProductionBonusIsInMaxLvl()) { milestoneDescription = Dictionary.getString("PRODUCTION_MILESTONE_DESC_1") + " " + UserDataManager.GetInstance().getTotalRiceProduced() / 1000.0f + " " + Dictionary.getString("PRODUCTION_MILESTONE_DESC_2") + " " + coopMan.getNextTotalProductionGoal() + " t."; } else { milestoneDescription = Dictionary.getString("MAX_BONUS"); } currentBonus = Dictionary.getString("CURRENT_BONUS") + ": " + coopMan.getCurrentTotalProductionBonus() + Dictionary.getString("COINS_AUGMENTED"); if (!coopMan.totalProductionBonusIsInMaxLvl()) { nextBonus = Dictionary.getString("NEXT_BONUS") + ": " + coopMan.getNextTotalProductionBonus() + Dictionary.getString("COINS_AUGMENTED"); } break; case MilestoneType.ANUAL_PRODUCTION: if (!coopMan.anualProductionBonusIsInMaxLvl()) { milestoneDescription = Dictionary.getString("ANUAL_PRODUCTION_MILESTONE_DESC_1") + " " + coopMan.getLastYearProduction() / 1000.0f + " " + Dictionary.getString("ANUAL_PRODUCTION_MILESTONE_DESC_2") + " " + coopMan.getNextAnualProductionGoal() + " t."; } else { milestoneDescription = Dictionary.getString("MAX_BONUS"); } MyUtils.Pair.Pair <int, int> currentAnualProductionBonus = coopMan.getCurrentAnualProductionBonus(); currentBonus = Dictionary.getString("CURRENT_BONUS") + ": " + currentAnualProductionBonus.First + Dictionary.getString("ANUAL_PRODUCTION_BONUS_1") + " " + currentAnualProductionBonus.Second + Dictionary.getString("ANUAL_PRODUCTION_BONUS_2"); MyUtils.Pair.Pair <int, int> nextAnualProductionBonus = coopMan.getNextAnualProductionBonus(); if (!coopMan.anualProductionBonusIsInMaxLvl()) { nextBonus = Dictionary.getString("NEXT_BONUS") + ": " + nextAnualProductionBonus.First + Dictionary.getString("ANUAL_PRODUCTION_BONUS_1") + " " + nextAnualProductionBonus.Second + Dictionary.getString("ANUAL_PRODUCTION_BONUS_2"); } break; } m_itemDescriptionText.text = milestoneDescription; m_currentItemBonusText.text = currentBonus; m_nextItemBonusText.text = nextBonus; for (int i = 0; i < (int)MilestoneType.NUMBER_MILESTONES; ++i) { m_coopPanels[i].GetComponent <Image>().enabled = false; } m_coopPanels[(int)m_selectedMilestone].GetComponent <Image>().enabled = true; }