void ProbabilityRevision() { int survivablePlanetCount = 0; int planetCount = 0; for (int i = 2; i <= 4; i++) { for (int j = 0; j < sectorTiles[i].onSector.transform.childCount; j++) { planetCount++; if (sectorTiles[i].onSector.transform.GetChild(j).GetComponent <PlanetBase>().canSurvive) { survivablePlanetCount++; } } } while ((float)survivablePlanetCount / (float)planetCount < dm.GetCurrentSectorData(currentSector).minimumSuccessRate / 9.0f) { Sector s = sectorTiles[Random.Range(2, 5)].onSector; PlanetBase p = s.transform.GetChild(Random.Range(0, s.transform.childCount)).GetComponent <PlanetBase>(); if (p.canSurvive == false && p.isExplored == false) { p.SetData(planetFactory.GetScript(true), true); survivablePlanetCount++; } } }
public void ResetScriptLanguage(PlanetBase planet) { if (planet.name == "Earth") { string[] engEarthScript = new string[3] { "Home of Human race.", "Critical pollution detected.", "Serious resource exhaustion." }; if (languageMgr.currLanguage == Language.English) { planet.SetData(engEarthScript, false); } return; } string[] newScripts = GetScript(planet.canSurvive); planet.SetData(newScripts, planet.canSurvive); }
public void ResetScriptLanguage(PlanetBase planet) { if (planet.name == "Earth") { string[] engEarthScript = new string[3] { "Home of Human race.", "Critical pollution detected.", "Serious resource exhaustion." }; if (languageMgr.currLanguage == Language.English) planet.SetData(engEarthScript, false); return; } string[] newScripts = GetScript(planet.canSurvive); planet.SetData(newScripts, planet.canSurvive); }