/// <summary> /// The function adds another planet to list when density gains proper level /// </summary> /// <returns>bool</returns> public bool tryToColonize() { if (listOfPlanets.getCurrentPlanet().CheckIfDensityTooHigh()) { if (factors.getTechLevel() > 3000) { if (random.Next(0, 25) == 0) { factors.ModifyTechLevelByAddition(-3000); listOfPlanets.AddNewPlanet(); return(true); } } } return(false); }
private void timerMainTimer(object sender, EventArgs e) { //two functions below modify inhabitants number and techlevel factors.ModifyTechLevelByAddition(50); factors.ModifyInhabitantsByAddition(); //functions below are responsible for gui and displaying stats labelPopulationNumber.Text = factors.getPopulation().ToString(); labelInhabitants.Text = listOfPlanets.getCurrentPlanet().getInhabitants().ToString(); labelPlanetsNumber.Text = listOfPlanets.getPlanetsAmount().ToString(); labelTechLevel.Text = factors.getTechLevel().ToString(); labelRacesAmount.Text = listOfPlanets.getCurrentPlanet().getAmountfRaces().ToString(); labelDensity.Text = listOfPlanets.getCurrentPlanet().getDensity().ToString(); raceControl.TryTooCreateNewRace(); //If war occurs, then picture changes if (warControl.TryToStartWar()) { pictureBox.Image = Properties.Resources.battle; labelWorldEvent.Text = "IT'S WAR TIME!"; } //If colonisation occurs, then picture changes if (colonisation.tryToColonize()) { pictureBox.Image = Properties.Resources.colonisation; labelWorldEvent.Text = "IT'S COLONISATION TIME!"; } //If famine occurs, then picture changes if (disaster.Famine()) { pictureBox.Image = Properties.Resources.famine; labelWorldEvent.Text = "IT'S FAMINE TIME!"; } }